""" AUTO-GENERATED FILE - DO NOT EDIT Generated from: api.schema.json """ from __future__ import annotations from typing import ClassVar, TYPE_CHECKING from .session_events import AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionLimitsConfig, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval if TYPE_CHECKING: from .._jsonrpc import JsonRpcClient from collections.abc import Callable from dataclasses import dataclass from datetime import datetime from enum import Enum from typing import Any, Protocol, TypeVar, cast from uuid import UUID import dateutil.parser T = TypeVar("T") EnumT = TypeVar("EnumT", bound=Enum) def from_str(x: Any) -> str: assert isinstance(x, str) return x def from_none(x: Any) -> Any: assert x is None return x def from_union(fs, x): for f in fs: try: return f(x) except Exception: pass assert False def to_class(c: type[T], x: Any) -> dict: assert isinstance(x, c) return cast(Any, x).to_dict() def from_bool(x: Any) -> bool: assert isinstance(x, bool) return x def from_float(x: Any) -> float: assert isinstance(x, (float, int)) and not isinstance(x, bool) return float(x) def to_float(x: Any) -> float: assert isinstance(x, (int, float)) return x def from_dict(f: Callable[[Any], T], x: Any) -> dict[str, T]: assert isinstance(x, dict) return { k: f(v) for (k, v) in x.items() } def from_list(f: Callable[[Any], T], x: Any) -> list[T]: assert isinstance(x, list) return [f(y) for y in x] def to_enum(c: type[EnumT], x: Any) -> EnumT: assert isinstance(x, c) return x.value def from_int(x: Any) -> int: assert isinstance(x, int) and not isinstance(x, bool) return x def from_datetime(x: Any) -> datetime: return dateutil.parser.parse(x) # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AbortRequest: """Parameters for aborting the current turn""" reason: AbortReason | None = None """Finite reason code describing why the current turn was aborted""" @staticmethod def from_dict(obj: Any) -> 'AbortRequest': assert isinstance(obj, dict) reason = from_union([AbortReason, from_none], obj.get("reason")) return AbortRequest(reason) def to_dict(self) -> dict: result: dict = {} if self.reason is not None: result["reason"] = from_union([lambda x: to_enum(AbortReason, x), from_none], self.reason) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AbortResult: """Result of aborting the current turn""" success: bool """Whether the abort completed successfully""" error: str | None = None """Error message if the abort failed""" @staticmethod def from_dict(obj: Any) -> 'AbortResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) error = from_union([from_str, from_none], obj.get("error")) return AbortResult(success, error) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseEndpoints: """Schema for the `CopilotUserResponseEndpoints` type.""" api: str | None = None origin_tracker: str | None = None proxy: str | None = None telemetry: str | None = None @staticmethod def from_dict(obj: Any) -> 'CopilotUserResponseEndpoints': assert isinstance(obj, dict) api = from_union([from_str, from_none], obj.get("api")) origin_tracker = from_union([from_str, from_none], obj.get("origin-tracker")) proxy = from_union([from_str, from_none], obj.get("proxy")) telemetry = from_union([from_str, from_none], obj.get("telemetry")) return CopilotUserResponseEndpoints(api, origin_tracker, proxy, telemetry) def to_dict(self) -> dict: result: dict = {} if self.api is not None: result["api"] = from_union([from_str, from_none], self.api) if self.origin_tracker is not None: result["origin-tracker"] = from_union([from_str, from_none], self.origin_tracker) if self.proxy is not None: result["proxy"] = from_union([from_str, from_none], self.proxy) if self.telemetry is not None: result["telemetry"] = from_union([from_str, from_none], self.telemetry) return result # Experimental: this type is part of an experimental API and may change or be removed. class AuthInfoType(Enum): """Authentication type""" API_KEY = "api-key" COPILOT_API_TOKEN = "copilot-api-token" ENV = "env" GH_CLI = "gh-cli" HMAC = "hmac" TOKEN = "token" USER = "user" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountAllUsers: """Schema for the `AccountAllUsers` type. List of all authenticated users """ auth_info: AuthInfo """Authentication information for this user""" token: str | None = None """Associated token, if available""" @staticmethod def from_dict(obj: Any) -> 'AccountAllUsers': assert isinstance(obj, dict) auth_info = _load_AuthInfo(obj.get("authInfo")) token = from_union([from_str, from_none], obj.get("token")) return AccountAllUsers(auth_info, token) def to_dict(self) -> dict: result: dict = {} result["authInfo"] = (self.auth_info).to_dict() if self.token is not None: result["token"] = from_union([from_str, from_none], self.token) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountGetCurrentAuthResult: """Current authentication state""" auth_errors: list[str] | None = None """Authentication errors from the last auth attempt, if any""" auth_info: AuthInfo | None = None """Current authentication information, if authenticated""" @staticmethod def from_dict(obj: Any) -> 'AccountGetCurrentAuthResult': assert isinstance(obj, dict) auth_errors = from_union([lambda x: from_list(from_str, x), from_none], obj.get("authErrors")) auth_info = from_union([_load_AuthInfo, from_none], obj.get("authInfo")) return AccountGetCurrentAuthResult(auth_errors, auth_info) def to_dict(self) -> dict: result: dict = {} if self.auth_errors is not None: result["authErrors"] = from_union([lambda x: from_list(from_str, x), from_none], self.auth_errors) if self.auth_info is not None: result["authInfo"] = from_union([lambda x: (x).to_dict(), from_none], self.auth_info) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountGetQuotaRequest: git_hub_token: str | None = None """GitHub token for per-user quota lookup. When provided, resolves this token to determine the user's quota instead of using the global auth. """ @staticmethod def from_dict(obj: Any) -> 'AccountGetQuotaRequest': assert isinstance(obj, dict) git_hub_token = from_union([from_str, from_none], obj.get("gitHubToken")) return AccountGetQuotaRequest(git_hub_token) def to_dict(self) -> dict: result: dict = {} if self.git_hub_token is not None: result["gitHubToken"] = from_union([from_str, from_none], self.git_hub_token) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountQuotaSnapshot: """Schema for the `AccountQuotaSnapshot` type.""" entitlement_requests: int """Number of requests included in the entitlement, or -1 for unlimited entitlements""" is_unlimited_entitlement: bool """Whether the user has an unlimited usage entitlement""" overage: float """Number of additional usage requests made this period""" overage_allowed_with_exhausted_quota: bool """Whether additional usage is allowed when quota is exhausted""" remaining_percentage: float """Percentage of entitlement remaining""" usage_allowed_with_exhausted_quota: bool """Whether usage is still permitted after quota exhaustion""" used_requests: int """Number of requests used so far this period""" reset_date: str | None = None """Date when the quota resets (ISO 8601 string)""" @staticmethod def from_dict(obj: Any) -> 'AccountQuotaSnapshot': assert isinstance(obj, dict) entitlement_requests = from_int(obj.get("entitlementRequests")) is_unlimited_entitlement = from_bool(obj.get("isUnlimitedEntitlement")) overage = from_float(obj.get("overage")) overage_allowed_with_exhausted_quota = from_bool(obj.get("overageAllowedWithExhaustedQuota")) remaining_percentage = from_float(obj.get("remainingPercentage")) usage_allowed_with_exhausted_quota = from_bool(obj.get("usageAllowedWithExhaustedQuota")) used_requests = from_int(obj.get("usedRequests")) reset_date = from_union([from_str, from_none], obj.get("resetDate")) return AccountQuotaSnapshot(entitlement_requests, is_unlimited_entitlement, overage, overage_allowed_with_exhausted_quota, remaining_percentage, usage_allowed_with_exhausted_quota, used_requests, reset_date) def to_dict(self) -> dict: result: dict = {} result["entitlementRequests"] = from_int(self.entitlement_requests) result["isUnlimitedEntitlement"] = from_bool(self.is_unlimited_entitlement) result["overage"] = to_float(self.overage) result["overageAllowedWithExhaustedQuota"] = from_bool(self.overage_allowed_with_exhausted_quota) result["remainingPercentage"] = to_float(self.remaining_percentage) result["usageAllowedWithExhaustedQuota"] = from_bool(self.usage_allowed_with_exhausted_quota) result["usedRequests"] = from_int(self.used_requests) if self.reset_date is not None: result["resetDate"] = from_union([from_str, from_none], self.reset_date) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountLoginRequest: """Credentials to store after successful authentication""" host: str """GitHub host URL""" login: str """User login/username""" token: str """GitHub authentication token""" @staticmethod def from_dict(obj: Any) -> 'AccountLoginRequest': assert isinstance(obj, dict) host = from_str(obj.get("host")) login = from_str(obj.get("login")) token = from_str(obj.get("token")) return AccountLoginRequest(host, login, token) def to_dict(self) -> dict: result: dict = {} result["host"] = from_str(self.host) result["login"] = from_str(self.login) result["token"] = from_str(self.token) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountLoginResult: """Result of a successful login; throws on failure""" stored_in_vault: bool """Whether the credential was persisted to a secure store (system keychain, or the config file when plaintext storage is enabled). False when no secure store was available and the token was not saved, so the consumer can decide how to proceed. """ @staticmethod def from_dict(obj: Any) -> 'AccountLoginResult': assert isinstance(obj, dict) stored_in_vault = from_bool(obj.get("storedInVault")) return AccountLoginResult(stored_in_vault) def to_dict(self) -> dict: result: dict = {} result["storedInVault"] = from_bool(self.stored_in_vault) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountLogoutRequest: """User to log out""" auth_info: AuthInfo """Authentication information for the user to log out""" @staticmethod def from_dict(obj: Any) -> 'AccountLogoutRequest': assert isinstance(obj, dict) auth_info = _load_AuthInfo(obj.get("authInfo")) return AccountLogoutRequest(auth_info) def to_dict(self) -> dict: result: dict = {} result["authInfo"] = (self.auth_info).to_dict() return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountLogoutResult: """Logout result indicating if more users remain""" has_more_users: bool """Whether other authenticated users remain after logout""" @staticmethod def from_dict(obj: Any) -> 'AccountLogoutResult': assert isinstance(obj, dict) has_more_users = from_bool(obj.get("hasMoreUsers")) return AccountLogoutResult(has_more_users) def to_dict(self) -> dict: result: dict = {} result["hasMoreUsers"] = from_bool(self.has_more_users) return result # Experimental: this type is part of an experimental API and may change or be removed. class AdaptiveThinkingSupport(Enum): """Resolved Anthropic adaptive-thinking capability for a model. Resolved Anthropic adaptive-thinking capability — unsupported / optional / required. 'required' models reject thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8). """ OPTIONAL = "optional" REQUIRED = "required" UNSUPPORTED = "unsupported" # Experimental: this type is part of an experimental API and may change or be removed. class AgentDiscoveryPathScope(Enum): """Which tier this directory belongs to""" PROJECT = "project" USER = "user" # Experimental: this type is part of an experimental API and may change or be removed. class AgentInfoSource(Enum): """Where the agent definition was loaded from""" BUILTIN = "builtin" INHERITED = "inherited" PLUGIN = "plugin" PROJECT = "project" REMOTE = "remote" USER = "user" # Experimental: this type is part of an experimental API and may change or be removed. class AgentRegistryLiveTargetEntryAttentionKind(Enum): """Kind of attention required when status === "attention". Meaningful only when status === "attention". """ ELICITATION = "elicitation" ERROR = "error" EXIT_PLAN = "exit_plan" PERMISSION = "permission" USER_INPUT = "user_input" # Experimental: this type is part of an experimental API and may change or be removed. class AgentRegistryLiveTargetEntryKind(Enum): """Process kind tag for the registry entry""" MANAGED_SERVER = "managed-server" UI_SERVER = "ui-server" # Experimental: this type is part of an experimental API and may change or be removed. class AgentRegistryLiveTargetEntryLastTerminalEvent(Enum): """How the most recent turn ended (clean vs aborted). Lets the renderer distinguish done from done_cancelled. """ ABORT = "abort" TURN_END = "turn_end" # Experimental: this type is part of an experimental API and may change or be removed. class AgentRegistryLiveTargetEntryStatus(Enum): """Coarse lifecycle status of the foreground session""" ATTENTION = "attention" DONE = "done" WAITING = "waiting" WORKING = "working" # Experimental: this type is part of an experimental API and may change or be removed. class AgentRegistryLogCaptureOpenErrorReason(Enum): """Categorized reason for log-open failure""" DISK_FULL = "disk_full" OTHER = "other" PERMISSION = "permission" class AgentRegistrySpawnErrorKind(Enum): SPAWN_ERROR = "spawn-error" # Experimental: this type is part of an experimental API and may change or be removed. class AgentRegistrySpawnPermissionMode(Enum): """Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. """ DEFAULT = "default" YOLO = "yolo" class AgentRegistrySpawnRegistryTimeoutKind(Enum): REGISTRY_TIMEOUT = "registry-timeout" # Experimental: this type is part of an experimental API and may change or be removed. class AgentRegistrySpawnValidationErrorField(Enum): """Which parameter field was invalid. Omitted when the rejection is not field-specific.""" AGENT_NAME = "agentName" CWD = "cwd" MODEL = "model" NAME = "name" PERMISSION_MODE = "permissionMode" class AgentRegistrySpawnResultKind(Enum): REGISTRY_TIMEOUT = "registry-timeout" SPAWNED = "spawned" SPAWN_ERROR = "spawn-error" VALIDATION_ERROR = "validation-error" # Experimental: this type is part of an experimental API and may change or be removed. class AgentRegistrySpawnValidationErrorReason(Enum): """Categorized reason for the rejection. Low-cardinality enum so telemetry can aggregate by reason without leaking raw paths or agent/model names. """ CWD_NOT_DIRECTORY = "cwd-not-directory" CWD_NOT_FOUND = "cwd-not-found" INVALID_NAME = "invalid-name" UNKNOWN_AGENT = "unknown-agent" UNKNOWN_MODEL = "unknown-model" YOLO_NOT_ALLOWED = "yolo-not-allowed" class AgentRegistrySpawnSpawnedKind(Enum): SPAWNED = "spawned" class AgentRegistrySpawnValidationErrorKind(Enum): VALIDATION_ERROR = "validation-error" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentSelectRequest: """Name of the custom agent to select for subsequent turns.""" name: str """Name of the custom agent to select""" @staticmethod def from_dict(obj: Any) -> 'AgentSelectRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return AgentSelectRequest(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentsDiscoverRequest: """Optional project paths to include in agent discovery.""" exclude_host_agents: bool | None = None """When true, omit the host's agents (the user-level agent directory and all plugin agents), leaving only project and remote agents. For multitenant deployments. """ project_paths: list[str] | None = None """Optional list of project directory paths to scan for project-scoped agents. When omitted or empty, only user/plugin/remote-independent agents are returned (no project scan). """ @staticmethod def from_dict(obj: Any) -> 'AgentsDiscoverRequest': assert isinstance(obj, dict) exclude_host_agents = from_union([from_bool, from_none], obj.get("excludeHostAgents")) project_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("projectPaths")) return AgentsDiscoverRequest(exclude_host_agents, project_paths) def to_dict(self) -> dict: result: dict = {} if self.exclude_host_agents is not None: result["excludeHostAgents"] = from_union([from_bool, from_none], self.exclude_host_agents) if self.project_paths is not None: result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentsGetDiscoveryPathsRequest: """Optional project paths to include when enumerating agent discovery directories.""" exclude_host_agents: bool | None = None """When true, omit the host's user-level agent directory, leaving only project directories. For multitenant deployments (mirrors `discover`'s `excludeHostAgents`). """ project_paths: list[str] | None = None """Optional list of project directory paths. When omitted or empty, only the user-level directory is returned. """ @staticmethod def from_dict(obj: Any) -> 'AgentsGetDiscoveryPathsRequest': assert isinstance(obj, dict) exclude_host_agents = from_union([from_bool, from_none], obj.get("excludeHostAgents")) project_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("projectPaths")) return AgentsGetDiscoveryPathsRequest(exclude_host_agents, project_paths) def to_dict(self) -> dict: result: dict = {} if self.exclude_host_agents is not None: result["excludeHostAgents"] = from_union([from_bool, from_none], self.exclude_host_agents) if self.project_paths is not None: result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AllowAllPermissionSetResult: """Indicates whether the operation succeeded and reports the post-mutation state.""" enabled: bool """Authoritative allow-all state after the mutation""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'AllowAllPermissionSetResult': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) success = from_bool(obj.get("success")) return AllowAllPermissionSetResult(enabled, success) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AllowAllPermissionState: """Current full allow-all permission state.""" enabled: bool """Whether full allow-all permissions are currently active""" @staticmethod def from_dict(obj: Any) -> 'AllowAllPermissionState': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) return AllowAllPermissionState(enabled) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) return result class APIKeyAuthInfoType(Enum): API_KEY = "api-key" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CancelUserRequestedShellCommandResult: """Cancellation result for a user-requested shell command.""" cancelled: bool """Whether an in-flight execution was found and signalled to cancel""" @staticmethod def from_dict(obj: Any) -> 'CancelUserRequestedShellCommandResult': assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return CancelUserRequestedShellCommandResult(cancelled) def to_dict(self) -> dict: result: dict = {} result["cancelled"] = from_bool(self.cancelled) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasAction: """Canvas action that the agent or host can invoke. To discover the input schema for a particular action, call the list_canvas_capabilities tool. """ name: str """Action name exposed by the canvas provider""" description: str | None = None """Description of the action""" input_schema: Any = None """JSON Schema for the action input""" @staticmethod def from_dict(obj: Any) -> 'CanvasAction': assert isinstance(obj, dict) name = from_str(obj.get("name")) description = from_union([from_str, from_none], obj.get("description")) input_schema = obj.get("inputSchema") return CanvasAction(name, description, input_schema) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.input_schema is not None: result["inputSchema"] = self.input_schema return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasActionInvokeRequest: """Canvas action invocation parameters.""" action_name: str """Action name to invoke""" instance_id: str """Open canvas instance identifier""" input: Any = None """Action input""" @staticmethod def from_dict(obj: Any) -> 'CanvasActionInvokeRequest': assert isinstance(obj, dict) action_name = from_str(obj.get("actionName")) instance_id = from_str(obj.get("instanceId")) input = obj.get("input") return CanvasActionInvokeRequest(action_name, instance_id, input) def to_dict(self) -> dict: result: dict = {} result["actionName"] = from_str(self.action_name) result["instanceId"] = from_str(self.instance_id) if self.input is not None: result["input"] = self.input return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasCloseRequest: """Canvas close parameters.""" instance_id: str """Open canvas instance identifier""" @staticmethod def from_dict(obj: Any) -> 'CanvasCloseRequest': assert isinstance(obj, dict) instance_id = from_str(obj.get("instanceId")) return CanvasCloseRequest(instance_id) def to_dict(self) -> dict: result: dict = {} result["instanceId"] = from_str(self.instance_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class OpenCanvasInstance: """Open canvas instance snapshot.""" canvas_id: str """Provider-local canvas identifier""" extension_id: str """Owning provider identifier""" instance_id: str """Stable caller-supplied canvas instance identifier""" extension_name: str | None = None """Owning extension display name, when available""" input: Any = None """Input supplied when the instance was opened""" status: str | None = None """Provider-supplied status text""" title: str | None = None """Rendered title""" url: str | None = None """URL for web-rendered canvases""" @staticmethod def from_dict(obj: Any) -> 'OpenCanvasInstance': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) extension_id = from_str(obj.get("extensionId")) instance_id = from_str(obj.get("instanceId")) extension_name = from_union([from_str, from_none], obj.get("extensionName")) input = obj.get("input") status = from_union([from_str, from_none], obj.get("status")) title = from_union([from_str, from_none], obj.get("title")) url = from_union([from_str, from_none], obj.get("url")) return OpenCanvasInstance(canvas_id, extension_id, instance_id, extension_name, input, status, title, url) def to_dict(self) -> dict: result: dict = {} result["canvasId"] = from_str(self.canvas_id) result["extensionId"] = from_str(self.extension_id) result["instanceId"] = from_str(self.instance_id) if self.extension_name is not None: result["extensionName"] = from_union([from_str, from_none], self.extension_name) if self.input is not None: result["input"] = self.input if self.status is not None: result["status"] = from_union([from_str, from_none], self.status) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasOpenRequest: """Canvas open parameters.""" canvas_id: str """Provider-local canvas identifier""" instance_id: str """Caller-supplied stable instance identifier""" extension_id: str | None = None """Owning provider identifier. Optional when the canvasId is unique across providers; required to disambiguate when multiple providers register the same canvasId. """ input: Any = None """Canvas open input""" @staticmethod def from_dict(obj: Any) -> 'CanvasOpenRequest': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) instance_id = from_str(obj.get("instanceId")) extension_id = from_union([from_str, from_none], obj.get("extensionId")) input = obj.get("input") return CanvasOpenRequest(canvas_id, instance_id, extension_id, input) def to_dict(self) -> dict: result: dict = {} result["canvasId"] = from_str(self.canvas_id) result["instanceId"] = from_str(self.instance_id) if self.extension_id is not None: result["extensionId"] = from_union([from_str, from_none], self.extension_id) if self.input is not None: result["input"] = self.input return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasSessionContext: """Session context supplied by the runtime.""" working_directory: str | None = None """Active session working directory, when known.""" @staticmethod def from_dict(obj: Any) -> 'CanvasSessionContext': assert isinstance(obj, dict) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) return CanvasSessionContext(working_directory) def to_dict(self) -> dict: result: dict = {} if self.working_directory is not None: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasProviderOpenResult: """Canvas open result returned by the provider.""" status: str | None = None """Provider-supplied status text""" title: str | None = None """Provider-supplied title""" url: str | None = None """URL for web-rendered canvases""" @staticmethod def from_dict(obj: Any) -> 'CanvasProviderOpenResult': assert isinstance(obj, dict) status = from_union([from_str, from_none], obj.get("status")) title = from_union([from_str, from_none], obj.get("title")) url = from_union([from_str, from_none], obj.get("url")) return CanvasProviderOpenResult(status, title, url) def to_dict(self) -> dict: result: dict = {} if self.status is not None: result["status"] = from_union([from_str, from_none], self.status) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CapiSessionOptions: """Options scoped to the built-in CAPI (Copilot API) provider.""" enable_web_socket_responses: bool | None = None """Whether to use WebSocket transport for the CAPI Responses API. Enabled by default when the model advertises `ws:/responses` support; set to `false` to force the HTTP Responses transport in environments where WebSockets are blocked (e.g. behind a proxy). Setting this to `false` is equivalent to the `COPILOT_CLI_DISABLE_WEBSOCKET_RESPONSES` environment variable. """ @staticmethod def from_dict(obj: Any) -> 'CapiSessionOptions': assert isinstance(obj, dict) enable_web_socket_responses = from_union([from_bool, from_none], obj.get("enableWebSocketResponses")) return CapiSessionOptions(enable_web_socket_responses) def to_dict(self) -> dict: result: dict = {} if self.enable_web_socket_responses is not None: result["enableWebSocketResponses"] = from_union([from_bool, from_none], self.enable_web_socket_responses) return result # Experimental: this type is part of an experimental API and may change or be removed. class SlashCommandInputCompletion(Enum): """Optional completion hint for the input (e.g. 'directory' for filesystem path completion)""" DIRECTORY = "directory" # Experimental: this type is part of an experimental API and may change or be removed. class SlashCommandKind(Enum): """Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command """ BUILTIN = "builtin" CLIENT = "client" SKILL = "skill" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsHandlePendingCommandRequest: """Pending command request ID and an optional error if the client handler failed.""" request_id: str """Request ID from the command invocation event""" error: str | None = None """Error message if the command handler failed""" @staticmethod def from_dict(obj: Any) -> 'CommandsHandlePendingCommandRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) error = from_union([from_str, from_none], obj.get("error")) return CommandsHandlePendingCommandRequest(request_id, error) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsHandlePendingCommandResult: """Indicates whether the pending client-handled command was completed successfully.""" success: bool """Whether the command was handled successfully""" @staticmethod def from_dict(obj: Any) -> 'CommandsHandlePendingCommandResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return CommandsHandlePendingCommandResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsInvokeRequest: """Slash command name and optional raw input string to invoke.""" name: str """Command name. Leading slashes are stripped and the name is matched case-insensitively.""" input: str | None = None """Raw input after the command name""" @staticmethod def from_dict(obj: Any) -> 'CommandsInvokeRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) input = from_union([from_str, from_none], obj.get("input")) return CommandsInvokeRequest(name, input) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) if self.input is not None: result["input"] = from_union([from_str, from_none], self.input) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsListRequest: """Optional filters controlling which command sources to include in the listing.""" include_builtins: bool | None = None """Include runtime built-in commands""" include_client_commands: bool | None = None """Include commands registered by protocol clients, including SDK clients and extensions""" include_skills: bool | None = None """Include enabled user-invocable skills and commands""" @staticmethod def from_dict(obj: Any) -> 'CommandsListRequest': assert isinstance(obj, dict) include_builtins = from_union([from_bool, from_none], obj.get("includeBuiltins")) include_client_commands = from_union([from_bool, from_none], obj.get("includeClientCommands")) include_skills = from_union([from_bool, from_none], obj.get("includeSkills")) return CommandsListRequest(include_builtins, include_client_commands, include_skills) def to_dict(self) -> dict: result: dict = {} if self.include_builtins is not None: result["includeBuiltins"] = from_union([from_bool, from_none], self.include_builtins) if self.include_client_commands is not None: result["includeClientCommands"] = from_union([from_bool, from_none], self.include_client_commands) if self.include_skills is not None: result["includeSkills"] = from_union([from_bool, from_none], self.include_skills) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsRespondToQueuedCommandRequest: """Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). """ request_id: str """Request ID from the `command.queued` event the host is responding to.""" result: QueuedCommandResult """Result of the queued command execution.""" @staticmethod def from_dict(obj: Any) -> 'CommandsRespondToQueuedCommandRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = _load_QueuedCommandResult(obj.get("result")) return CommandsRespondToQueuedCommandRequest(request_id, result) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["result"] = (self.result).to_dict() return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsRespondToQueuedCommandResult: """Indicates whether the queued-command response was matched to a pending request.""" success: bool """Whether a pending queued command with the given request ID was found and resolved. False when the request was already resolved, cancelled, or unknown. """ @staticmethod def from_dict(obj: Any) -> 'CommandsRespondToQueuedCommandResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return CommandsRespondToQueuedCommandResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CompletionsGetTriggerCharactersResult: """Characters that, when typed in the composer, should trigger a `completions.request`. Empty when the session has no host-driven completions (e.g. local sessions, or a relay host that does not advertise `completionTriggerCharacters`). """ trigger_characters: list[str] """Trigger characters advertised by the host (e.g. `["@", "#"]`). Empty disables host-driven completions for the session. """ @staticmethod def from_dict(obj: Any) -> 'CompletionsGetTriggerCharactersResult': assert isinstance(obj, dict) trigger_characters = from_list(from_str, obj.get("triggerCharacters")) return CompletionsGetTriggerCharactersResult(trigger_characters) def to_dict(self) -> dict: result: dict = {} result["triggerCharacters"] = from_list(from_str, self.trigger_characters) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CompletionsRequestRequest: """Request host-driven completions for the current composer input.""" offset: int """Cursor offset within `text`, in UTF-16 code units.""" text: str """The full composed composer input.""" @staticmethod def from_dict(obj: Any) -> 'CompletionsRequestRequest': assert isinstance(obj, dict) offset = from_int(obj.get("offset")) text = from_str(obj.get("text")) return CompletionsRequestRequest(offset, text) def to_dict(self) -> dict: result: dict = {} result["offset"] = from_int(self.offset) result["text"] = from_str(self.text) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionCompletionItem: """A single host-driven completion. Accepting an item replaces `[rangeStart, rangeEnd)` (UTF-16 code units) in the composer with `insertText`; when the range is absent, the active token around the cursor is replaced. """ insert_text: str """Text spliced into the composer when the item is accepted.""" kind: str | None = None """Render-kind hint for the picker row (e.g. `"document"`, `"directory"`), derived from the host's display kind. """ label: str | None = None """Primary display label for the picker row. Falls back to `insertText` when absent.""" range_end: int | None = None """End (exclusive) of the replacement range in `text`, in UTF-16 code units.""" range_start: int | None = None """Start of the replacement range in `text`, in UTF-16 code units.""" @staticmethod def from_dict(obj: Any) -> 'SessionCompletionItem': assert isinstance(obj, dict) insert_text = from_str(obj.get("insertText")) kind = from_union([from_str, from_none], obj.get("kind")) label = from_union([from_str, from_none], obj.get("label")) range_end = from_union([from_int, from_none], obj.get("rangeEnd")) range_start = from_union([from_int, from_none], obj.get("rangeStart")) return SessionCompletionItem(insert_text, kind, label, range_end, range_start) def to_dict(self) -> dict: result: dict = {} result["insertText"] = from_str(self.insert_text) if self.kind is not None: result["kind"] = from_union([from_str, from_none], self.kind) if self.label is not None: result["label"] = from_union([from_str, from_none], self.label) if self.range_end is not None: result["rangeEnd"] = from_union([from_int, from_none], self.range_end) if self.range_start is not None: result["rangeStart"] = from_union([from_int, from_none], self.range_start) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _ConfigureSessionExtensionsParams: """Params to attach or detach an in-process ExtensionController delegate.""" session_id: str """Session to attach the extension controller delegate to.""" controller: Any = None """In-process ExtensionController delegate (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. The post-SDK extension surface exposes list/enable/disable/reload via dedicated RPCs served by the runtime. """ @staticmethod def from_dict(obj: Any) -> '_ConfigureSessionExtensionsParams': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) controller = obj.get("controller") return _ConfigureSessionExtensionsParams(session_id, controller) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) if self.controller is not None: result["controller"] = self.controller return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectRemoteSessionParams: """Remote session connection parameters.""" session_id: str """Session ID to connect to.""" @staticmethod def from_dict(obj: Any) -> 'ConnectRemoteSessionParams': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return ConnectRemoteSessionParams(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _ConnectRequest: """Optional connection token presented by the SDK client during the handshake.""" token: str | None = None """Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN""" @staticmethod def from_dict(obj: Any) -> '_ConnectRequest': assert isinstance(obj, dict) token = from_union([from_str, from_none], obj.get("token")) return _ConnectRequest(token) def to_dict(self) -> dict: result: dict = {} if self.token is not None: result["token"] = from_union([from_str, from_none], self.token) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _ConnectResult: """Handshake result reporting the server's protocol version and package version on success.""" ok: bool """Always true on success""" protocol_version: int """Server protocol version number""" version: str """Server package version""" @staticmethod def from_dict(obj: Any) -> '_ConnectResult': assert isinstance(obj, dict) ok = from_bool(obj.get("ok")) protocol_version = from_int(obj.get("protocolVersion")) version = from_str(obj.get("version")) return _ConnectResult(ok, protocol_version, version) def to_dict(self) -> dict: result: dict = {} result["ok"] = from_bool(self.ok) result["protocolVersion"] = from_int(self.protocol_version) result["version"] = from_str(self.version) return result # Experimental: this type is part of an experimental API and may change or be removed. class ConnectedRemoteSessionMetadataKind(Enum): """Neutral SDK discriminator for the connected remote session kind.""" CODING_AGENT = "coding-agent" REMOTE_SESSION = "remote-session" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectedRemoteSessionMetadataRepository: """Repository associated with the connected remote session.""" branch: str """Branch associated with the remote session.""" name: str """Repository name.""" owner: str """Repository owner or organization login.""" @staticmethod def from_dict(obj: Any) -> 'ConnectedRemoteSessionMetadataRepository': assert isinstance(obj, dict) branch = from_str(obj.get("branch")) name = from_str(obj.get("name")) owner = from_str(obj.get("owner")) return ConnectedRemoteSessionMetadataRepository(branch, name, owner) def to_dict(self) -> dict: result: dict = {} result["branch"] = from_str(self.branch) result["name"] = from_str(self.name) result["owner"] = from_str(self.owner) return result # Experimental: this type is part of an experimental API and may change or be removed. class ContentFilterMode(Enum): """Controls how MCP tool result content is filtered: none leaves content unchanged, markdown sanitizes HTML while preserving Markdown-friendly output, and hidden_characters removes characters that can hide directives. """ HIDDEN_CHARACTERS = "hidden_characters" MARKDOWN = "markdown" NONE = "none" class Host(Enum): HTTPS_GITHUB_COM = "https://github.com" class CopilotAPITokenAuthInfoType(Enum): COPILOT_API_TOKEN = "copilot-api-token" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsChat: """Schema for the `CopilotUserResponseQuotaSnapshotsChat` type.""" entitlement: float | None = None has_quota: bool | None = None overage_count: float | None = None overage_permitted: bool | None = None percent_remaining: float | None = None quota_id: str | None = None quota_remaining: float | None = None quota_reset_at: float | None = None remaining: float | None = None timestamp_utc: str | None = None token_based_billing: bool | None = None unlimited: bool | None = None @staticmethod def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsChat': assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) overage_count = from_union([from_float, from_none], obj.get("overage_count")) overage_permitted = from_union([from_bool, from_none], obj.get("overage_permitted")) percent_remaining = from_union([from_float, from_none], obj.get("percent_remaining")) quota_id = from_union([from_str, from_none], obj.get("quota_id")) quota_remaining = from_union([from_float, from_none], obj.get("quota_remaining")) quota_reset_at = from_union([from_float, from_none], obj.get("quota_reset_at")) remaining = from_union([from_float, from_none], obj.get("remaining")) timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) return CopilotUserResponseQuotaSnapshotsChat(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) def to_dict(self) -> dict: result: dict = {} if self.entitlement is not None: result["entitlement"] = from_union([to_float, from_none], self.entitlement) if self.has_quota is not None: result["has_quota"] = from_union([from_bool, from_none], self.has_quota) if self.overage_count is not None: result["overage_count"] = from_union([to_float, from_none], self.overage_count) if self.overage_permitted is not None: result["overage_permitted"] = from_union([from_bool, from_none], self.overage_permitted) if self.percent_remaining is not None: result["percent_remaining"] = from_union([to_float, from_none], self.percent_remaining) if self.quota_id is not None: result["quota_id"] = from_union([from_str, from_none], self.quota_id) if self.quota_remaining is not None: result["quota_remaining"] = from_union([to_float, from_none], self.quota_remaining) if self.quota_reset_at is not None: result["quota_reset_at"] = from_union([to_float, from_none], self.quota_reset_at) if self.remaining is not None: result["remaining"] = from_union([to_float, from_none], self.remaining) if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsCompletions: """Schema for the `CopilotUserResponseQuotaSnapshotsCompletions` type.""" entitlement: float | None = None has_quota: bool | None = None overage_count: float | None = None overage_permitted: bool | None = None percent_remaining: float | None = None quota_id: str | None = None quota_remaining: float | None = None quota_reset_at: float | None = None remaining: float | None = None timestamp_utc: str | None = None token_based_billing: bool | None = None unlimited: bool | None = None @staticmethod def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsCompletions': assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) overage_count = from_union([from_float, from_none], obj.get("overage_count")) overage_permitted = from_union([from_bool, from_none], obj.get("overage_permitted")) percent_remaining = from_union([from_float, from_none], obj.get("percent_remaining")) quota_id = from_union([from_str, from_none], obj.get("quota_id")) quota_remaining = from_union([from_float, from_none], obj.get("quota_remaining")) quota_reset_at = from_union([from_float, from_none], obj.get("quota_reset_at")) remaining = from_union([from_float, from_none], obj.get("remaining")) timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) return CopilotUserResponseQuotaSnapshotsCompletions(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) def to_dict(self) -> dict: result: dict = {} if self.entitlement is not None: result["entitlement"] = from_union([to_float, from_none], self.entitlement) if self.has_quota is not None: result["has_quota"] = from_union([from_bool, from_none], self.has_quota) if self.overage_count is not None: result["overage_count"] = from_union([to_float, from_none], self.overage_count) if self.overage_permitted is not None: result["overage_permitted"] = from_union([from_bool, from_none], self.overage_permitted) if self.percent_remaining is not None: result["percent_remaining"] = from_union([to_float, from_none], self.percent_remaining) if self.quota_id is not None: result["quota_id"] = from_union([from_str, from_none], self.quota_id) if self.quota_remaining is not None: result["quota_remaining"] = from_union([to_float, from_none], self.quota_remaining) if self.quota_reset_at is not None: result["quota_reset_at"] = from_union([to_float, from_none], self.quota_reset_at) if self.remaining is not None: result["remaining"] = from_union([to_float, from_none], self.remaining) if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsPremiumInteractions: """Schema for the `CopilotUserResponseQuotaSnapshotsPremiumInteractions` type.""" entitlement: float | None = None has_quota: bool | None = None overage_count: float | None = None overage_permitted: bool | None = None percent_remaining: float | None = None quota_id: str | None = None quota_remaining: float | None = None quota_reset_at: float | None = None remaining: float | None = None timestamp_utc: str | None = None token_based_billing: bool | None = None unlimited: bool | None = None @staticmethod def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsPremiumInteractions': assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) overage_count = from_union([from_float, from_none], obj.get("overage_count")) overage_permitted = from_union([from_bool, from_none], obj.get("overage_permitted")) percent_remaining = from_union([from_float, from_none], obj.get("percent_remaining")) quota_id = from_union([from_str, from_none], obj.get("quota_id")) quota_remaining = from_union([from_float, from_none], obj.get("quota_remaining")) quota_reset_at = from_union([from_float, from_none], obj.get("quota_reset_at")) remaining = from_union([from_float, from_none], obj.get("remaining")) timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) return CopilotUserResponseQuotaSnapshotsPremiumInteractions(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) def to_dict(self) -> dict: result: dict = {} if self.entitlement is not None: result["entitlement"] = from_union([to_float, from_none], self.entitlement) if self.has_quota is not None: result["has_quota"] = from_union([from_bool, from_none], self.has_quota) if self.overage_count is not None: result["overage_count"] = from_union([to_float, from_none], self.overage_count) if self.overage_permitted is not None: result["overage_permitted"] = from_union([from_bool, from_none], self.overage_permitted) if self.percent_remaining is not None: result["percent_remaining"] = from_union([to_float, from_none], self.percent_remaining) if self.quota_id is not None: result["quota_id"] = from_union([from_str, from_none], self.quota_id) if self.quota_remaining is not None: result["quota_remaining"] = from_union([to_float, from_none], self.quota_remaining) if self.quota_reset_at is not None: result["quota_reset_at"] = from_union([to_float, from_none], self.quota_reset_at) if self.remaining is not None: result["remaining"] = from_union([to_float, from_none], self.remaining) if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CurrentModel: """The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. """ context_tier: ContextTier | None = None """Context tier for models that support multiple context-window sizes.""" model_id: str | None = None """Currently active model identifier""" reasoning_effort: str | None = None """Reasoning effort level currently applied to the active model, when one is set. Reads `Session.getReasoningEffort()` synchronously after `getSelectedModel()` resolves so the two values are reported as a snapshot. """ @staticmethod def from_dict(obj: Any) -> 'CurrentModel': assert isinstance(obj, dict) context_tier = from_union([ContextTier, from_none], obj.get("contextTier")) model_id = from_union([from_str, from_none], obj.get("modelId")) reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) return CurrentModel(context_tier, model_id, reasoning_effort) def to_dict(self) -> dict: result: dict = {} if self.context_tier is not None: result["contextTier"] = from_union([lambda x: to_enum(ContextTier, x), from_none], self.context_tier) if self.model_id is not None: result["modelId"] = from_union([from_str, from_none], self.model_id) if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) return result # Experimental: this type is part of an experimental API and may change or be removed. class DiscoveredMCPServerType(Enum): """Server transport type: stdio, http, sse (deprecated), or memory""" HTTP = "http" MEMORY = "memory" SSE = "sse" STDIO = "stdio" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnqueueCommandParams: """Slash-prefixed command string to enqueue for FIFO processing.""" command: str """Slash-prefixed command string to enqueue, e.g. '/compact' or '/model gpt-4'. Queued FIFO with any in-flight items; if the session is idle, processing kicks off immediately. """ @staticmethod def from_dict(obj: Any) -> 'EnqueueCommandParams': assert isinstance(obj, dict) command = from_str(obj.get("command")) return EnqueueCommandParams(command) def to_dict(self) -> dict: result: dict = {} result["command"] = from_str(self.command) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnqueueCommandResult: """Indicates whether the command was accepted into the local execution queue.""" queued: bool """True when the command was accepted into the local execution queue. False when the call targets a session that does not support local command queueing (e.g. remote sessions). """ @staticmethod def from_dict(obj: Any) -> 'EnqueueCommandResult': assert isinstance(obj, dict) queued = from_bool(obj.get("queued")) return EnqueueCommandResult(queued) def to_dict(self) -> dict: result: dict = {} result["queued"] = from_bool(self.queued) return result class EnvAuthInfoType(Enum): ENV = "env" # Experimental: this type is part of an experimental API and may change or be removed. class EventsAgentScope(Enum): """Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. """ ALL = "all" PRIMARY = "primary" # Experimental: this type is part of an experimental API and may change or be removed. class EventLogTypes(Enum): EMPTY = "*" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogReleaseInterestResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'EventLogReleaseInterestResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return EventLogReleaseInterestResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogTailResult: """Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). """ cursor: str """Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). """ @staticmethod def from_dict(obj: Any) -> 'EventLogTailResult': assert isinstance(obj, dict) cursor = from_str(obj.get("cursor")) return EventLogTailResult(cursor) def to_dict(self) -> dict: result: dict = {} result["cursor"] = from_str(self.cursor) return result # Experimental: this type is part of an experimental API and may change or be removed. class EventsCursorStatus(Enum): """Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read started from the beginning of the remaining history. """ EXPIRED = "expired" OK = "ok" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExecuteCommandParams: """Slash command name and argument string to execute synchronously.""" args: str """Argument string to pass to the command (empty string if none).""" command_name: str """Name of the slash command to invoke (without the leading '/').""" @staticmethod def from_dict(obj: Any) -> 'ExecuteCommandParams': assert isinstance(obj, dict) args = from_str(obj.get("args")) command_name = from_str(obj.get("commandName")) return ExecuteCommandParams(args, command_name) def to_dict(self) -> dict: result: dict = {} result["args"] = from_str(self.args) result["commandName"] = from_str(self.command_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExecuteCommandResult: """Error message produced while executing the command, if any.""" error: str | None = None """Error message produced while executing the command, if any. Omitted when the handler succeeded. """ @staticmethod def from_dict(obj: Any) -> 'ExecuteCommandResult': assert isinstance(obj, dict) error = from_union([from_str, from_none], obj.get("error")) return ExecuteCommandResult(error) def to_dict(self) -> dict: result: dict = {} if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. class ExtensionSource(Enum): """Discovery source: project (.github/extensions/), user (~/.copilot/extensions/), plugin (installed plugin), or session (session-state//extensions/) """ PLUGIN = "plugin" PROJECT = "project" SESSION = "session" USER = "user" # Experimental: this type is part of an experimental API and may change or be removed. class ExtensionStatus(Enum): """Current status: running, disabled, failed, or starting""" DISABLED = "disabled" FAILED = "failed" RUNNING = "running" STARTING = "starting" class ExtensionContextPushInputType(Enum): EXTENSION_CONTEXT = "extension_context" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionsDisableRequest: """Source-qualified extension identifier to disable for the session.""" id: str """Source-qualified extension ID to disable""" @staticmethod def from_dict(obj: Any) -> 'ExtensionsDisableRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return ExtensionsDisableRequest(id) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionsEnableRequest: """Source-qualified extension identifier to enable for the session.""" id: str """Source-qualified extension ID to enable""" @staticmethod def from_dict(obj: Any) -> 'ExtensionsEnableRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return ExtensionsEnableRequest(id) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) return result # Experimental: this type is part of an experimental API and may change or be removed. class ExternalToolTextResultForLlmBinaryResultsForLlmType(Enum): """Binary result type discriminator. Use "image" for images and "resource" for other binary data. """ IMAGE = "image" RESOURCE = "resource" # Experimental: this type is part of an experimental API and may change or be removed. class Theme(Enum): """Theme variant this icon is intended for UI theme preference per SEP-1865 """ DARK = "dark" LIGHT = "light" class ExternalToolTextResultForLlmContentType(Enum): AUDIO = "audio" IMAGE = "image" RESOURCE = "resource" RESOURCE_LINK = "resource_link" SHELL_EXIT = "shell_exit" TERMINAL = "terminal" TEXT = "text" class ExternalToolTextResultForLlmContentAudioType(Enum): AUDIO = "audio" class ExternalToolTextResultForLlmContentImageType(Enum): IMAGE = "image" class ExternalToolTextResultForLlmContentResourceType(Enum): RESOURCE = "resource" class ExternalToolTextResultForLlmContentResourceLinkType(Enum): RESOURCE_LINK = "resource_link" class ExternalToolTextResultForLlmContentShellExitType(Enum): SHELL_EXIT = "shell_exit" class ExternalToolTextResultForLlmContentTerminalType(Enum): TERMINAL = "terminal" class KindEnum(Enum): TEXT = "text" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FleetStartRequest: """Optional user prompt to combine with the fleet orchestration instructions.""" prompt: str | None = None """Optional user prompt to combine with fleet instructions""" @staticmethod def from_dict(obj: Any) -> 'FleetStartRequest': assert isinstance(obj, dict) prompt = from_union([from_str, from_none], obj.get("prompt")) return FleetStartRequest(prompt) def to_dict(self) -> dict: result: dict = {} if self.prompt is not None: result["prompt"] = from_union([from_str, from_none], self.prompt) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FleetStartResult: """Indicates whether fleet mode was successfully activated.""" started: bool """Whether fleet mode was successfully activated""" @staticmethod def from_dict(obj: Any) -> 'FleetStartResult': assert isinstance(obj, dict) started = from_bool(obj.get("started")) return FleetStartResult(started) def to_dict(self) -> dict: result: dict = {} result["started"] = from_bool(self.started) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustAddParams: """Folder path to add to trusted folders.""" path: str """Folder path to mark as trusted""" @staticmethod def from_dict(obj: Any) -> 'FolderTrustAddParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return FolderTrustAddParams(path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustCheckParams: """Folder path to check for trust.""" path: str """Folder path to check""" @staticmethod def from_dict(obj: Any) -> 'FolderTrustCheckParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return FolderTrustCheckParams(path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustCheckResult: """Folder trust check result.""" trusted: bool """Whether the folder is trusted""" @staticmethod def from_dict(obj: Any) -> 'FolderTrustCheckResult': assert isinstance(obj, dict) trusted = from_bool(obj.get("trusted")) return FolderTrustCheckResult(trusted) def to_dict(self) -> dict: result: dict = {} result["trusted"] = from_bool(self.trusted) return result class GhCLIAuthInfoType(Enum): GH_CLI = "gh-cli" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class GitHubTelemetryClientInfo: """Client environment metadata describing the process that produced a telemetry event. Client environment metadata. """ cli_version: str """Copilot CLI version string.""" node_version: str """Node.js runtime version string.""" os_arch: str """Operating system architecture (e.g. arm64, x64).""" os_platform: str """Operating system platform (e.g. darwin, linux, win32).""" os_version: str """Operating system version string.""" client_name: str | None = None """Name of the client application.""" client_type: str | None = None """Type of client.""" copilot_plan: str | None = None """Copilot subscription plan, when known.""" dev_device_id: str | None = None """Stable machine identifier for the device.""" is_staff: bool | None = None """Whether the user is a GitHub/Microsoft staff member.""" @staticmethod def from_dict(obj: Any) -> 'GitHubTelemetryClientInfo': assert isinstance(obj, dict) cli_version = from_str(obj.get("cli_version")) node_version = from_str(obj.get("node_version")) os_arch = from_str(obj.get("os_arch")) os_platform = from_str(obj.get("os_platform")) os_version = from_str(obj.get("os_version")) client_name = from_union([from_str, from_none], obj.get("client_name")) client_type = from_union([from_str, from_none], obj.get("client_type")) copilot_plan = from_union([from_str, from_none], obj.get("copilot_plan")) dev_device_id = from_union([from_str, from_none], obj.get("dev_device_id")) is_staff = from_union([from_bool, from_none], obj.get("is_staff")) return GitHubTelemetryClientInfo(cli_version, node_version, os_arch, os_platform, os_version, client_name, client_type, copilot_plan, dev_device_id, is_staff) def to_dict(self) -> dict: result: dict = {} result["cli_version"] = from_str(self.cli_version) result["node_version"] = from_str(self.node_version) result["os_arch"] = from_str(self.os_arch) result["os_platform"] = from_str(self.os_platform) result["os_version"] = from_str(self.os_version) if self.client_name is not None: result["client_name"] = from_union([from_str, from_none], self.client_name) if self.client_type is not None: result["client_type"] = from_union([from_str, from_none], self.client_type) if self.copilot_plan is not None: result["copilot_plan"] = from_union([from_str, from_none], self.copilot_plan) if self.dev_device_id is not None: result["dev_device_id"] = from_union([from_str, from_none], self.dev_device_id) if self.is_staff is not None: result["is_staff"] = from_union([from_bool, from_none], self.is_staff) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HandlePendingToolCallResult: """Indicates whether the external tool call result was handled successfully.""" success: bool """Whether the tool call result was handled successfully""" @staticmethod def from_dict(obj: Any) -> 'HandlePendingToolCallResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return HandlePendingToolCallResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryAbortManualCompactionResult: """Indicates whether an in-progress manual compaction was aborted.""" aborted: bool """Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. """ @staticmethod def from_dict(obj: Any) -> 'HistoryAbortManualCompactionResult': assert isinstance(obj, dict) aborted = from_bool(obj.get("aborted")) return HistoryAbortManualCompactionResult(aborted) def to_dict(self) -> dict: result: dict = {} result["aborted"] = from_bool(self.aborted) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCancelBackgroundCompactionResult: """Indicates whether an in-progress background compaction was cancelled.""" cancelled: bool """Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. """ @staticmethod def from_dict(obj: Any) -> 'HistoryCancelBackgroundCompactionResult': assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return HistoryCancelBackgroundCompactionResult(cancelled) def to_dict(self) -> dict: result: dict = {} result["cancelled"] = from_bool(self.cancelled) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactContextWindow: """Post-compaction context window usage breakdown""" current_tokens: int """Current total tokens in the context window (system + conversation + tool definitions)""" messages_length: int """Current number of messages in the conversation""" token_limit: int """Maximum token count for the model's context window""" conversation_tokens: int | None = None """Token count from non-system messages (user, assistant, tool)""" system_tokens: int | None = None """Token count from system message(s)""" tool_definitions_tokens: int | None = None """Token count from tool definitions""" @staticmethod def from_dict(obj: Any) -> 'HistoryCompactContextWindow': assert isinstance(obj, dict) current_tokens = from_int(obj.get("currentTokens")) messages_length = from_int(obj.get("messagesLength")) token_limit = from_int(obj.get("tokenLimit")) conversation_tokens = from_union([from_int, from_none], obj.get("conversationTokens")) system_tokens = from_union([from_int, from_none], obj.get("systemTokens")) tool_definitions_tokens = from_union([from_int, from_none], obj.get("toolDefinitionsTokens")) return HistoryCompactContextWindow(current_tokens, messages_length, token_limit, conversation_tokens, system_tokens, tool_definitions_tokens) def to_dict(self) -> dict: result: dict = {} result["currentTokens"] = from_int(self.current_tokens) result["messagesLength"] = from_int(self.messages_length) result["tokenLimit"] = from_int(self.token_limit) if self.conversation_tokens is not None: result["conversationTokens"] = from_union([from_int, from_none], self.conversation_tokens) if self.system_tokens is not None: result["systemTokens"] = from_union([from_int, from_none], self.system_tokens) if self.tool_definitions_tokens is not None: result["toolDefinitionsTokens"] = from_union([from_int, from_none], self.tool_definitions_tokens) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactRequest: """Optional compaction parameters.""" custom_instructions: str | None = None """Optional user-provided instructions to focus the compaction summary""" @staticmethod def from_dict(obj: Any) -> 'HistoryCompactRequest': assert isinstance(obj, dict) custom_instructions = from_union([from_str, from_none], obj.get("customInstructions")) return HistoryCompactRequest(custom_instructions) def to_dict(self) -> dict: result: dict = {} if self.custom_instructions is not None: result["customInstructions"] = from_union([from_str, from_none], self.custom_instructions) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistorySummarizeForHandoffResult: """Markdown summary of the conversation context (empty when not available).""" summary: str """Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. """ @staticmethod def from_dict(obj: Any) -> 'HistorySummarizeForHandoffResult': assert isinstance(obj, dict) summary = from_str(obj.get("summary")) return HistorySummarizeForHandoffResult(summary) def to_dict(self) -> dict: result: dict = {} result["summary"] = from_str(self.summary) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryTruncateRequest: """Identifier of the event to truncate to; this event and all later events are removed.""" event_id: str """Event ID to truncate to. This event and all events after it are removed from the session.""" @staticmethod def from_dict(obj: Any) -> 'HistoryTruncateRequest': assert isinstance(obj, dict) event_id = from_str(obj.get("eventId")) return HistoryTruncateRequest(event_id) def to_dict(self) -> dict: result: dict = {} result["eventId"] = from_str(self.event_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryTruncateResult: """Number of events that were removed by the truncation.""" events_removed: int """Number of events that were removed""" @staticmethod def from_dict(obj: Any) -> 'HistoryTruncateResult': assert isinstance(obj, dict) events_removed = from_int(obj.get("eventsRemoved")) return HistoryTruncateResult(events_removed) def to_dict(self) -> dict: result: dict = {} result["eventsRemoved"] = from_int(self.events_removed) return result class HMACAuthInfoType(Enum): HMAC = "hmac" class PurpleSource(Enum): GITHUB = "github" LOCAL = "local" URL = "url" class FluffySource(Enum): GITHUB = "github" class TentacledSource(Enum): LOCAL = "local" class StickySource(Enum): URL = "url" # Experimental: this type is part of an experimental API and may change or be removed. class InstructionDiscoveryPathKind(Enum): """Whether the target is a single file or a directory of instruction files Entry type """ DIRECTORY = "directory" FILE = "file" # Experimental: this type is part of an experimental API and may change or be removed. class InstructionLocation(Enum): """Which tier this target belongs to Where this source lives — used for UI grouping """ PLUGIN = "plugin" REPOSITORY = "repository" USER = "user" WORKING_DIRECTORY = "working-directory" # Experimental: this type is part of an experimental API and may change or be removed. class InstructionSourceType(Enum): """Category of instruction source — used for merge logic""" CHILD_INSTRUCTIONS = "child-instructions" HOME = "home" MODEL = "model" NESTED_AGENTS = "nested-agents" PLUGIN = "plugin" REPO = "repo" VSCODE = "vscode" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionsDiscoverRequest: """Optional project paths to include in instruction discovery.""" exclude_host_instructions: bool | None = None """When true, omit the host's instruction sources (user/home-level files and plugin rules), leaving only repository and working-directory sources. For multitenant deployments. """ project_paths: list[str] | None = None """Optional list of project directory paths to scan for repository/working-directory instruction sources. When omitted or empty, only user-level and plugin instruction sources are returned (no project scan). """ @staticmethod def from_dict(obj: Any) -> 'InstructionsDiscoverRequest': assert isinstance(obj, dict) exclude_host_instructions = from_union([from_bool, from_none], obj.get("excludeHostInstructions")) project_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("projectPaths")) return InstructionsDiscoverRequest(exclude_host_instructions, project_paths) def to_dict(self) -> dict: result: dict = {} if self.exclude_host_instructions is not None: result["excludeHostInstructions"] = from_union([from_bool, from_none], self.exclude_host_instructions) if self.project_paths is not None: result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionsGetDiscoveryPathsRequest: """Optional project paths to include when enumerating instruction discovery targets.""" exclude_host_instructions: bool | None = None """When true, omit the host's user-level instruction targets, leaving only repository targets. For multitenant deployments (mirrors `discover`'s `excludeHostInstructions`). """ project_paths: list[str] | None = None """Optional list of project directory paths. When omitted or empty, only the user-level targets are returned. """ @staticmethod def from_dict(obj: Any) -> 'InstructionsGetDiscoveryPathsRequest': assert isinstance(obj, dict) exclude_host_instructions = from_union([from_bool, from_none], obj.get("excludeHostInstructions")) project_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("projectPaths")) return InstructionsGetDiscoveryPathsRequest(exclude_host_instructions, project_paths) def to_dict(self) -> dict: result: dict = {} if self.exclude_host_instructions is not None: result["excludeHostInstructions"] = from_union([from_bool, from_none], self.exclude_host_instructions) if self.project_paths is not None: result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) return result @dataclass class LlmInferenceHTTPRequestChunkRequest: """A request body chunk or cancellation signal.""" data: str """Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty. """ request_id: str """Matches the requestId from the originating httpRequestStart frame.""" binary: bool | None = None """When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text.""" cancel: bool | None = None """When true, the runtime is cancelling the in-flight request (e.g. upstream consumer aborted). `data` is ignored. Implies end-of-request. """ cancel_reason: str | None = None """Optional human-readable reason for the cancellation, propagated for logging.""" end: bool | None = None """When true, this is the final body chunk for the request. The SDK may rely on having received an end-marked chunk before treating the request body as complete. """ @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPRequestChunkRequest': assert isinstance(obj, dict) data = from_str(obj.get("data")) request_id = from_str(obj.get("requestId")) binary = from_union([from_bool, from_none], obj.get("binary")) cancel = from_union([from_bool, from_none], obj.get("cancel")) cancel_reason = from_union([from_str, from_none], obj.get("cancelReason")) end = from_union([from_bool, from_none], obj.get("end")) return LlmInferenceHTTPRequestChunkRequest(data, request_id, binary, cancel, cancel_reason, end) def to_dict(self) -> dict: result: dict = {} result["data"] = from_str(self.data) result["requestId"] = from_str(self.request_id) if self.binary is not None: result["binary"] = from_union([from_bool, from_none], self.binary) if self.cancel is not None: result["cancel"] = from_union([from_bool, from_none], self.cancel) if self.cancel_reason is not None: result["cancelReason"] = from_union([from_str, from_none], self.cancel_reason) if self.end is not None: result["end"] = from_union([from_bool, from_none], self.end) return result @dataclass class LlmInferenceHTTPRequestChunkResult: """Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget. """ @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPRequestChunkResult': assert isinstance(obj, dict) return LlmInferenceHTTPRequestChunkResult() def to_dict(self) -> dict: result: dict = {} return result class LlmInferenceHTTPRequestStartTransport(Enum): """Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. """ HTTP = "http" WEBSOCKET = "websocket" @dataclass class LlmInferenceHTTPRequestStartResult: """Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed. """ @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPRequestStartResult': assert isinstance(obj, dict) return LlmInferenceHTTPRequestStartResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LlmInferenceHTTPResponseChunkError: """Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. """ message: str """Human-readable failure description.""" code: str | None = None """Optional machine-readable error code.""" @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPResponseChunkError': assert isinstance(obj, dict) message = from_str(obj.get("message")) code = from_union([from_str, from_none], obj.get("code")) return LlmInferenceHTTPResponseChunkError(message, code) def to_dict(self) -> dict: result: dict = {} result["message"] = from_str(self.message) if self.code is not None: result["code"] = from_union([from_str, from_none], self.code) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LlmInferenceHTTPResponseChunkResult: """Whether the chunk was accepted.""" accepted: bool """True when the chunk was matched to a pending request; false when unknown.""" @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPResponseChunkResult': assert isinstance(obj, dict) accepted = from_bool(obj.get("accepted")) return LlmInferenceHTTPResponseChunkResult(accepted) def to_dict(self) -> dict: result: dict = {} result["accepted"] = from_bool(self.accepted) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LlmInferenceHTTPResponseStartRequest: """Response head.""" headers: dict[str, list[str]] request_id: str """Matches the requestId from the originating httpRequestStart frame.""" status: int """HTTP status code.""" status_text: str | None = None """Optional HTTP status reason phrase.""" @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPResponseStartRequest': assert isinstance(obj, dict) headers = from_dict(lambda x: from_list(from_str, x), obj.get("headers")) request_id = from_str(obj.get("requestId")) status = from_int(obj.get("status")) status_text = from_union([from_str, from_none], obj.get("statusText")) return LlmInferenceHTTPResponseStartRequest(headers, request_id, status, status_text) def to_dict(self) -> dict: result: dict = {} result["headers"] = from_dict(lambda x: from_list(from_str, x), self.headers) result["requestId"] = from_str(self.request_id) result["status"] = from_int(self.status) if self.status_text is not None: result["statusText"] = from_union([from_str, from_none], self.status_text) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LlmInferenceHTTPResponseStartResult: """Whether the start frame was accepted.""" accepted: bool """True when the response start was matched to a pending request; false when unknown.""" @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPResponseStartResult': assert isinstance(obj, dict) accepted = from_bool(obj.get("accepted")) return LlmInferenceHTTPResponseStartResult(accepted) def to_dict(self) -> dict: result: dict = {} result["accepted"] = from_bool(self.accepted) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LlmInferenceSetProviderResult: """Indicates whether the calling client was registered as the LLM inference provider.""" success: bool """Whether the provider was set successfully""" @staticmethod def from_dict(obj: Any) -> 'LlmInferenceSetProviderResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return LlmInferenceSetProviderResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. class HostType(Enum): """Repository host type Hosting platform type of the repository Repository host type, if known Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. """ ADO = "ado" GITHUB = "github" # Experimental: this type is part of an experimental API and may change or be removed. class SessionLogLevel(Enum): """Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". """ ERROR = "error" INFO = "info" WARNING = "warning" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LogResult: """Identifier of the session event that was emitted for the log message.""" event_id: UUID """The unique identifier of the emitted session event""" @staticmethod def from_dict(obj: Any) -> 'LogResult': assert isinstance(obj, dict) event_id = UUID(obj.get("eventId")) return LogResult(event_id) def to_dict(self) -> dict: result: dict = {} result["eventId"] = str(self.event_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LspInitializeRequest: """Parameters for (re)loading the merged LSP configuration set.""" force: bool | None = None """Force re-initialization even when LSP configs were already loaded for the working directory. """ git_root: str | None = None """Git root used as the boundary when traversing for project-level LSP configs (supports monorepos). """ working_directory: str | None = None """Working directory used to load project-level LSP configs. Defaults to the session working directory when omitted. """ @staticmethod def from_dict(obj: Any) -> 'LspInitializeRequest': assert isinstance(obj, dict) force = from_union([from_bool, from_none], obj.get("force")) git_root = from_union([from_str, from_none], obj.get("gitRoot")) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) return LspInitializeRequest(force, git_root, working_directory) def to_dict(self) -> dict: result: dict = {} if self.force is not None: result["force"] = from_union([from_bool, from_none], self.force) if self.git_root is not None: result["gitRoot"] = from_union([from_str, from_none], self.git_root) if self.working_directory is not None: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MarketplaceAddResult: """Result of registering a new marketplace.""" name: str """Final name of the marketplace as resolved from its manifest""" @staticmethod def from_dict(obj: Any) -> 'MarketplaceAddResult': assert isinstance(obj, dict) name = from_str(obj.get("name")) return MarketplaceAddResult(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MarketplaceInfo: """Registered marketplace summary.""" name: str """Marketplace name (matches the @marketplace suffix in plugin specs)""" source: str """Human-readable description of where the marketplace data is fetched from (e.g. "GitHub: owner/repo"). """ is_default: bool | None = None """True when this is a default marketplace shipped with the runtime. Defaults are not removable. """ @staticmethod def from_dict(obj: Any) -> 'MarketplaceInfo': assert isinstance(obj, dict) name = from_str(obj.get("name")) source = from_str(obj.get("source")) is_default = from_union([from_bool, from_none], obj.get("isDefault")) return MarketplaceInfo(name, source, is_default) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["source"] = from_str(self.source) if self.is_default is not None: result["isDefault"] = from_union([from_bool, from_none], self.is_default) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MarketplaceRefreshEntry: """Schema for the `MarketplaceRefreshEntry` type.""" name: str """Marketplace name that was refreshed""" success: bool """Whether the refresh succeeded""" error: str | None = None """Error message (failure only)""" @staticmethod def from_dict(obj: Any) -> 'MarketplaceRefreshEntry': assert isinstance(obj, dict) name = from_str(obj.get("name")) success = from_bool(obj.get("success")) error = from_union([from_str, from_none], obj.get("error")) return MarketplaceRefreshEntry(name, success, error) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["success"] = from_bool(self.success) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MarketplaceRemoveResult: """Outcome of the remove attempt, including dependent-plugin info when applicable.""" removed: bool """True when the marketplace was actually removed. False when removal was skipped because the marketplace has dependent plugins and `force` was not set. """ dependent_plugins: list[str] | None = None """Names of installed plugins that prevented removal. Populated only when `removed=false`.""" @staticmethod def from_dict(obj: Any) -> 'MarketplaceRemoveResult': assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) dependent_plugins = from_union([lambda x: from_list(from_str, x), from_none], obj.get("dependentPlugins")) return MarketplaceRemoveResult(removed, dependent_plugins) def to_dict(self) -> dict: result: dict = {} result["removed"] = from_bool(self.removed) if self.dependent_plugins is not None: result["dependentPlugins"] = from_union([lambda x: from_list(from_str, x), from_none], self.dependent_plugins) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAllowedServer: """Schema for the `McpAllowedServer` type.""" name: str """Allowed server name""" redacted_note: str | None = None """PII-free note explaining why the server was allowed""" @staticmethod def from_dict(obj: Any) -> 'MCPAllowedServer': assert isinstance(obj, dict) name = from_str(obj.get("name")) redacted_note = from_union([from_str, from_none], obj.get("redactedNote")) return MCPAllowedServer(name, redacted_note) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) if self.redacted_note is not None: result["redactedNote"] = from_union([from_str, from_none], self.redacted_note) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseCapability: """Capability negotiation snapshot""" advertised: bool """Whether the runtime advertises `extensions.io.modelcontextprotocol/ui` to MCP servers""" feature_flag_enabled: bool """Whether the MCP_APPS feature flag (or COPILOT_MCP_APPS env override) is on""" session_has_mcp_apps: bool """Whether the session has the `mcp-apps` capability""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsDiagnoseCapability': assert isinstance(obj, dict) advertised = from_bool(obj.get("advertised")) feature_flag_enabled = from_bool(obj.get("featureFlagEnabled")) session_has_mcp_apps = from_bool(obj.get("sessionHasMcpApps")) return MCPAppsDiagnoseCapability(advertised, feature_flag_enabled, session_has_mcp_apps) def to_dict(self) -> dict: result: dict = {} result["advertised"] = from_bool(self.advertised) result["featureFlagEnabled"] = from_bool(self.feature_flag_enabled) result["sessionHasMcpApps"] = from_bool(self.session_has_mcp_apps) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseRequest: """MCP server to diagnose MCP Apps wiring for.""" server_name: str """MCP server to probe""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsDiagnoseRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPAppsDiagnoseRequest(server_name) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseServer: """What the server returned for this session""" connected: bool """Whether the named server is currently connected""" sample_tool_names: list[str] """Up to 5 tool names with `_meta.ui` for quick inspection""" tool_count: float """Total tools returned by the server's tools/list""" tools_with_ui_meta: float """Tools whose `_meta.ui` is populated (resourceUri and/or visibility set)""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsDiagnoseServer': assert isinstance(obj, dict) connected = from_bool(obj.get("connected")) sample_tool_names = from_list(from_str, obj.get("sampleToolNames")) tool_count = from_float(obj.get("toolCount")) tools_with_ui_meta = from_float(obj.get("toolsWithUiMeta")) return MCPAppsDiagnoseServer(connected, sample_tool_names, tool_count, tools_with_ui_meta) def to_dict(self) -> dict: result: dict = {} result["connected"] = from_bool(self.connected) result["sampleToolNames"] = from_list(from_str, self.sample_tool_names) result["toolCount"] = to_float(self.tool_count) result["toolsWithUiMeta"] = to_float(self.tools_with_ui_meta) return result # Experimental: this type is part of an experimental API and may change or be removed. class MCPAppsDisplayMode(Enum): """Allowed values for the `McpAppsHostContextDetailsAvailableDisplayMode` enumeration. Current display mode (SEP-1865) Allowed values for the `McpAppsSetHostContextDetailsAvailableDisplayMode` enumeration. """ FULLSCREEN = "fullscreen" INLINE = "inline" PIP = "pip" # Experimental: this type is part of an experimental API and may change or be removed. class MCPAppsHostContextDetailsPlatform(Enum): """Platform type for responsive design""" DESKTOP = "desktop" MOBILE = "mobile" WEB = "web" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsListToolsRequest: """MCP server to list app-callable tools for.""" origin_server_name: str """**Required.** Server whose ui:// view issued the request. Per SEP-1865 ('callable by the app from this server only'), the call is rejected when this differs from `serverName`, and rejected outright when missing. """ server_name: str """MCP server hosting the app""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsListToolsRequest': assert isinstance(obj, dict) origin_server_name = from_str(obj.get("originServerName")) server_name = from_str(obj.get("serverName")) return MCPAppsListToolsRequest(origin_server_name, server_name) def to_dict(self) -> dict: result: dict = {} result["originServerName"] = from_str(self.origin_server_name) result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsListToolsResult: """App-callable tools from the named MCP server.""" tools: list[dict[str, Any]] """App-callable tools from the server""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsListToolsResult': assert isinstance(obj, dict) tools = from_list(lambda x: from_dict(lambda x: x, x), obj.get("tools")) return MCPAppsListToolsResult(tools) def to_dict(self) -> dict: result: dict = {} result["tools"] = from_list(lambda x: from_dict(lambda x: x, x), self.tools) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsReadResourceRequest: """MCP server and resource URI to fetch.""" server_name: str """Name of the MCP server hosting the resource""" uri: str """Resource URI (typically ui://...)""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsReadResourceRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) uri = from_str(obj.get("uri")) return MCPAppsReadResourceRequest(server_name, uri) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) result["uri"] = from_str(self.uri) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsResourceContent: """Schema for the `McpAppsResourceContent` type.""" uri: str """The resource URI (typically ui://...)""" meta: dict[str, Any] | None = None """Resource-level metadata (CSP, permissions, etc.)""" blob: str | None = None """Base64-encoded binary content""" mime_type: str | None = None """MIME type of the content""" text: str | None = None """Text content (e.g. HTML)""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsResourceContent': assert isinstance(obj, dict) uri = from_str(obj.get("uri")) meta = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("_meta")) blob = from_union([from_str, from_none], obj.get("blob")) mime_type = from_union([from_str, from_none], obj.get("mimeType")) text = from_union([from_str, from_none], obj.get("text")) return MCPAppsResourceContent(uri, meta, blob, mime_type, text) def to_dict(self) -> dict: result: dict = {} result["uri"] = from_str(self.uri) if self.meta is not None: result["_meta"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.meta) if self.blob is not None: result["blob"] = from_union([from_str, from_none], self.blob) if self.mime_type is not None: result["mimeType"] = from_union([from_str, from_none], self.mime_type) if self.text is not None: result["text"] = from_union([from_str, from_none], self.text) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPCancelSamplingExecutionParams: """The requestId previously passed to executeSampling that should be cancelled.""" request_id: str """The requestId previously passed to executeSampling that should be cancelled""" @staticmethod def from_dict(obj: Any) -> 'MCPCancelSamplingExecutionParams': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) return MCPCancelSamplingExecutionParams(request_id) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPCancelSamplingExecutionResult: """Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. """ cancelled: bool """True if an in-flight execution with the given requestId was found and signalled to cancel. False when no such execution is in flight (already completed, never started, or cancelled by another caller). """ @staticmethod def from_dict(obj: Any) -> 'MCPCancelSamplingExecutionResult': assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return MCPCancelSamplingExecutionResult(cancelled) def to_dict(self) -> dict: result: dict = {} result["cancelled"] = from_bool(self.cancelled) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerAuthConfigRedirectPort: """Authentication settings with optional redirect port configuration.""" redirect_port: int | None = None """Fixed port for the OAuth redirect callback server.""" @staticmethod def from_dict(obj: Any) -> 'MCPServerAuthConfigRedirectPort': assert isinstance(obj, dict) redirect_port = from_union([from_int, from_none], obj.get("redirectPort")) return MCPServerAuthConfigRedirectPort(redirect_port) def to_dict(self) -> dict: result: dict = {} if self.redirect_port is not None: result["redirectPort"] = from_union([from_int, from_none], self.redirect_port) return result # Experimental: this type is part of an experimental API and may change or be removed. class MCPServerConfigDeferTools(Enum): """Controls if tools provided by this server can be loaded on demand via tool search (auto) or always included in the initial tool list (never) """ AUTO = "auto" NEVER = "never" # Experimental: this type is part of an experimental API and may change or be removed. class MCPGrantType(Enum): """OAuth grant type to use when authenticating to the remote MCP server. OAuth grant type override for this login. Optional OAuth grant type override for this login. Defaults to the server configuration, or authorization_code when no grant type is specified. """ AUTHORIZATION_CODE = "authorization_code" CLIENT_CREDENTIALS = "client_credentials" # Experimental: this type is part of an experimental API and may change or be removed. class MCPServerConfigHTTPType(Enum): """Remote transport type. Defaults to "http" when omitted.""" HTTP = "http" SSE = "sse" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPConfigDisableRequest: """MCP server names to disable for new sessions.""" names: list[str] """Names of MCP servers to disable. Each server is added to the persisted disabled list so new sessions skip it. Already-disabled names are ignored. Active sessions keep their current connections until they end. """ @staticmethod def from_dict(obj: Any) -> 'MCPConfigDisableRequest': assert isinstance(obj, dict) names = from_list(from_str, obj.get("names")) return MCPConfigDisableRequest(names) def to_dict(self) -> dict: result: dict = {} result["names"] = from_list(from_str, self.names) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPConfigEnableRequest: """MCP server names to enable for new sessions.""" names: list[str] """Names of MCP servers to enable. Each server is removed from the persisted disabled list so new sessions spawn it. Unknown or already-enabled names are ignored. """ @staticmethod def from_dict(obj: Any) -> 'MCPConfigEnableRequest': assert isinstance(obj, dict) names = from_list(from_str, obj.get("names")) return MCPConfigEnableRequest(names) def to_dict(self) -> dict: result: dict = {} result["names"] = from_list(from_str, self.names) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPConfigRemoveRequest: """MCP server name to remove from user configuration.""" name: str """Name of the MCP server to remove""" @staticmethod def from_dict(obj: Any) -> 'MCPConfigRemoveRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return MCPConfigRemoveRequest(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class MCPConfigureGitHubRequest: """Opaque auth info used to configure GitHub MCP.""" auth_info: Any = None """Opaque runtime auth info for GitHub MCP configuration. Marked internal: an in-process runtime shape (configureGitHubMcp is a no-op over the wire). """ @staticmethod def from_dict(obj: Any) -> 'MCPConfigureGitHubRequest': assert isinstance(obj, dict) auth_info = obj.get("authInfo") return MCPConfigureGitHubRequest(auth_info) def to_dict(self) -> dict: result: dict = {} result["authInfo"] = self.auth_info return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPConfigureGitHubResult: """Result of configuring GitHub MCP.""" changed: bool """Whether GitHub MCP configuration changed.""" @staticmethod def from_dict(obj: Any) -> 'MCPConfigureGitHubResult': assert isinstance(obj, dict) changed = from_bool(obj.get("changed")) return MCPConfigureGitHubResult(changed) def to_dict(self) -> dict: result: dict = {} result["changed"] = from_bool(self.changed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPDisableRequest: """Name of the MCP server to disable for the session.""" server_name: str """Name of the MCP server to disable""" @staticmethod def from_dict(obj: Any) -> 'MCPDisableRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPDisableRequest(server_name) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPDiscoverRequest: """Optional working directory used as context for MCP server discovery.""" working_directory: str | None = None """Working directory used as context for discovery (e.g., plugin resolution)""" @staticmethod def from_dict(obj: Any) -> 'MCPDiscoverRequest': assert isinstance(obj, dict) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) return MCPDiscoverRequest(working_directory) def to_dict(self) -> dict: result: dict = {} if self.working_directory is not None: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPEnableRequest: """Name of the MCP server to enable for the session.""" server_name: str """Name of the MCP server to enable""" @staticmethod def from_dict(obj: Any) -> 'MCPEnableRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPEnableRequest(server_name) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPFilteredServer: """Schema for the `McpFilteredServer` type.""" name: str """Filtered server name""" reason: str """Human-readable filter reason""" enterprise_name: str | None = None """Enterprise login associated with an allowlist policy""" redacted_reason: str | None = None """PII-free filter reason""" @staticmethod def from_dict(obj: Any) -> 'MCPFilteredServer': assert isinstance(obj, dict) name = from_str(obj.get("name")) reason = from_str(obj.get("reason")) enterprise_name = from_union([from_str, from_none], obj.get("enterpriseName")) redacted_reason = from_union([from_str, from_none], obj.get("redactedReason")) return MCPFilteredServer(name, reason, enterprise_name, redacted_reason) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["reason"] = from_str(self.reason) if self.enterprise_name is not None: result["enterpriseName"] = from_union([from_str, from_none], self.enterprise_name) if self.redacted_reason is not None: result["redactedReason"] = from_union([from_str, from_none], self.redacted_reason) return result class MCPHeadersHandlePendingHeadersRefreshRequestKind(Enum): HEADERS = "headers" NONE = "none" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPHeadersHandlePendingHeadersRefreshRequestResult: """Indicates whether the pending MCP headers refresh response was accepted.""" success: bool """Whether the response was accepted. False if the request was unknown, timed out, or already resolved. """ @staticmethod def from_dict(obj: Any) -> 'MCPHeadersHandlePendingHeadersRefreshRequestResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return MCPHeadersHandlePendingHeadersRefreshRequestResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerFailureInfo: """Recorded MCP server connection failure.""" message: str """Failure message produced when the MCP server connection failed.""" timestamp: int """epoch-ms timestamp at which the failure was recorded.""" @staticmethod def from_dict(obj: Any) -> 'MCPServerFailureInfo': assert isinstance(obj, dict) message = from_str(obj.get("message")) timestamp = from_int(obj.get("timestamp")) return MCPServerFailureInfo(message, timestamp) def to_dict(self) -> dict: result: dict = {} result["message"] = from_str(self.message) result["timestamp"] = from_int(self.timestamp) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerNeedsAuthInfo: """Recorded MCP server pending-auth state.""" timestamp: int """epoch-ms timestamp at which the server signalled it needs authentication.""" @staticmethod def from_dict(obj: Any) -> 'MCPServerNeedsAuthInfo': assert isinstance(obj, dict) timestamp = from_int(obj.get("timestamp")) return MCPServerNeedsAuthInfo(timestamp) def to_dict(self) -> dict: result: dict = {} result["timestamp"] = from_int(self.timestamp) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPIsServerRunningRequest: """Server name to check running status for.""" server_name: str """Name of the MCP server to check""" @staticmethod def from_dict(obj: Any) -> 'MCPIsServerRunningRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPIsServerRunningRequest(server_name) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPIsServerRunningResult: """Whether the named MCP server is running.""" running: bool """True if the server has an active client and transport.""" @staticmethod def from_dict(obj: Any) -> 'MCPIsServerRunningResult': assert isinstance(obj, dict) running = from_bool(obj.get("running")) return MCPIsServerRunningResult(running) def to_dict(self) -> dict: result: dict = {} result["running"] = from_bool(self.running) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPListToolsRequest: """Server name whose tool list should be returned.""" server_name: str """Name of the connected MCP server whose tools to list.""" @staticmethod def from_dict(obj: Any) -> 'MCPListToolsRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPListToolsRequest(server_name) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) return result class MCPOauthPendingRequestResponseKind(Enum): CANCELLED = "cancelled" TOKEN = "token" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthHandlePendingResult: """Indicates whether the pending MCP OAuth response was accepted.""" success: bool """Whether the response was accepted. False if the request was unknown, timed out, or already resolved. """ @staticmethod def from_dict(obj: Any) -> 'MCPOauthHandlePendingResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return MCPOauthHandlePendingResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthLoginResult: """OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. """ authorization_url: str | None = None """URL the caller should open in a browser to complete OAuth. Omitted when cached tokens were still valid and no browser interaction was needed — the server is already reconnected in that case. When present, the runtime starts the callback listener before returning and continues the flow in the background; completion is signaled via session.mcp_server_status_changed. """ @staticmethod def from_dict(obj: Any) -> 'MCPOauthLoginResult': assert isinstance(obj, dict) authorization_url = from_union([from_str, from_none], obj.get("authorizationUrl")) return MCPOauthLoginResult(authorization_url) def to_dict(self) -> dict: result: dict = {} if self.authorization_url is not None: result["authorizationUrl"] = from_union([from_str, from_none], self.authorization_url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthRespondResult: """Empty result after recording the MCP OAuth response.""" @staticmethod def from_dict(obj: Any) -> 'MCPOauthRespondResult': assert isinstance(obj, dict) return MCPOauthRespondResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class MCPReloadWithConfigRequest: """Opaque MCP reload configuration.""" config: Any = None """Opaque runtime MCP reload configuration. Marked internal: an in-process runtime shape (reloadMcpServers throws over the wire). """ @staticmethod def from_dict(obj: Any) -> 'MCPReloadWithConfigRequest': assert isinstance(obj, dict) config = obj.get("config") return MCPReloadWithConfigRequest(config) def to_dict(self) -> dict: result: dict = {} result["config"] = self.config return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPRemoveGitHubResult: """Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). """ removed: bool """True when the auto-managed `github` MCP server was removed; false when no removal happened (e.g. user has explicitly configured a `github` server, or the server was not registered). """ @staticmethod def from_dict(obj: Any) -> 'MCPRemoveGitHubResult': assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return MCPRemoveGitHubResult(removed) def to_dict(self) -> dict: result: dict = {} result["removed"] = from_bool(self.removed) return result # Experimental: this type is part of an experimental API and may change or be removed. class MCPSamplingExecutionAction(Enum): """Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution. """ CANCELLED = "cancelled" FAILURE = "failure" SUCCESS = "success" # Experimental: this type is part of an experimental API and may change or be removed. class MCPSetEnvValueModeDetails(Enum): """How environment-variable values supplied to MCP servers are resolved. "direct" passes literal string values; "indirect" treats values as references (e.g. names of environment variables on the host) that the runtime resolves before launch. Defaults to the runtime's startup mode; clients that intentionally launch MCP servers with literal values (e.g. CLI prompt mode and ACP) set this to "direct". Mode recorded on the session after the update How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). How MCP server environment values are interpreted. """ DIRECT = "direct" INDIRECT = "indirect" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPStopServerRequest: """Server name for an individual MCP server stop.""" server_name: str """Name of the MCP server to stop""" @staticmethod def from_dict(obj: Any) -> 'MCPStopServerRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPStopServerRequest(server_name) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class MCPUnregisterExternalClientRequest: """Server name identifying the external client to remove.""" server_name: str """Server name of the external client to unregister""" @staticmethod def from_dict(obj: Any) -> 'MCPUnregisterExternalClientRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPUnregisterExternalClientRequest(server_name) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MemoryConfiguration: """Memory configuration for this session.""" enabled: bool """Whether memory is enabled for the session.""" @staticmethod def from_dict(obj: Any) -> 'MemoryConfiguration': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) return MemoryConfiguration(enabled) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionContextInfo: """Token-usage breakdown for the session's current context window""" buffer_tokens: int """Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%)""" compaction_threshold: int """Token count at which background compaction starts (configurable percentage of promptTokenLimit) """ conversation_tokens: int """Tokens consumed by user/assistant/tool messages""" limit: int """Prompt token limit plus the model's full output token limit.""" mcp_tools_tokens: int """Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools) """ model_name: str """The model used for token counting""" prompt_token_limit: int """Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified)""" system_tokens: int """Tokens consumed by the system prompt""" tool_definitions_tokens: int """Tokens consumed by tool definitions sent to the model (excludes deferred tools)""" total_tokens: int """Sum of system, conversation and tool-definition tokens""" @staticmethod def from_dict(obj: Any) -> 'SessionContextInfo': assert isinstance(obj, dict) buffer_tokens = from_int(obj.get("bufferTokens")) compaction_threshold = from_int(obj.get("compactionThreshold")) conversation_tokens = from_int(obj.get("conversationTokens")) limit = from_int(obj.get("limit")) mcp_tools_tokens = from_int(obj.get("mcpToolsTokens")) model_name = from_str(obj.get("modelName")) prompt_token_limit = from_int(obj.get("promptTokenLimit")) system_tokens = from_int(obj.get("systemTokens")) tool_definitions_tokens = from_int(obj.get("toolDefinitionsTokens")) total_tokens = from_int(obj.get("totalTokens")) return SessionContextInfo(buffer_tokens, compaction_threshold, conversation_tokens, limit, mcp_tools_tokens, model_name, prompt_token_limit, system_tokens, tool_definitions_tokens, total_tokens) def to_dict(self) -> dict: result: dict = {} result["bufferTokens"] = from_int(self.buffer_tokens) result["compactionThreshold"] = from_int(self.compaction_threshold) result["conversationTokens"] = from_int(self.conversation_tokens) result["limit"] = from_int(self.limit) result["mcpToolsTokens"] = from_int(self.mcp_tools_tokens) result["modelName"] = from_str(self.model_name) result["promptTokenLimit"] = from_int(self.prompt_token_limit) result["systemTokens"] = from_int(self.system_tokens) result["toolDefinitionsTokens"] = from_int(self.tool_definitions_tokens) result["totalTokens"] = from_int(self.total_tokens) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataIsProcessingResult: """Indicates whether the local session is currently processing a turn or background continuation. """ processing: bool """Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. """ @staticmethod def from_dict(obj: Any) -> 'MetadataIsProcessingResult': assert isinstance(obj, dict) processing = from_bool(obj.get("processing")) return MetadataIsProcessingResult(processing) def to_dict(self) -> dict: result: dict = {} result["processing"] = from_bool(self.processing) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecomputeContextTokensResult: """Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. """ messages_token_count: int """Tokens contributed by user/assistant/tool messages (excludes system/developer prompts).""" system_token_count: int """Tokens contributed by system/developer prompt snapshots.""" total_tokens: int """Sum of tokens across chat-context and system-context messages currently held by the session. """ @staticmethod def from_dict(obj: Any) -> 'MetadataRecomputeContextTokensResult': assert isinstance(obj, dict) messages_token_count = from_int(obj.get("messagesTokenCount")) system_token_count = from_int(obj.get("systemTokenCount")) total_tokens = from_int(obj.get("totalTokens")) return MetadataRecomputeContextTokensResult(messages_token_count, system_token_count, total_tokens) def to_dict(self) -> dict: result: dict = {} result["messagesTokenCount"] = from_int(self.messages_token_count) result["systemTokenCount"] = from_int(self.system_token_count) result["totalTokens"] = from_int(self.total_tokens) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecordContextChangeResult: """Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). """ @staticmethod def from_dict(obj: Any) -> 'MetadataRecordContextChangeResult': assert isinstance(obj, dict) return MetadataRecordContextChangeResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSetWorkingDirectoryRequest: """Absolute path to set as the session's new working directory.""" working_directory: str """Absolute path to set as the session's working directory. The runtime updates the session's recorded cwd so subsequent operations (shell tools, file lookups, telemetry) anchor to it. """ @staticmethod def from_dict(obj: Any) -> 'MetadataSetWorkingDirectoryRequest': assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return MetadataSetWorkingDirectoryRequest(working_directory) def to_dict(self) -> dict: result: dict = {} result["workingDirectory"] = from_str(self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSetWorkingDirectoryResult: """Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for `process.chdir` and any related side-effects (file index, etc.); this method only updates the session's own recorded path. """ working_directory: str """Working directory after the update""" @staticmethod def from_dict(obj: Any) -> 'MetadataSetWorkingDirectoryResult': assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return MetadataSetWorkingDirectoryResult(working_directory) def to_dict(self) -> dict: result: dict = {} result["workingDirectory"] = from_str(self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. class MetadataSnapshotCurrentMode(Enum): """The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot')""" AUTOPILOT = "autopilot" INTERACTIVE = "interactive" PLAN = "plan" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSnapshotRemoteMetadataRepository: """The repository the remote session targets.""" branch: str """The branch the remote session is operating on.""" name: str """The GitHub repository name (without owner).""" owner: str """The GitHub owner (user or organization) of the target repository.""" @staticmethod def from_dict(obj: Any) -> 'MetadataSnapshotRemoteMetadataRepository': assert isinstance(obj, dict) branch = from_str(obj.get("branch")) name = from_str(obj.get("name")) owner = from_str(obj.get("owner")) return MetadataSnapshotRemoteMetadataRepository(branch, name, owner) def to_dict(self) -> dict: result: dict = {} result["branch"] = from_str(self.branch) result["name"] = from_str(self.name) result["owner"] = from_str(self.owner) return result # Experimental: this type is part of an experimental API and may change or be removed. class TaskType(Enum): """Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. Whether the remote task originated from CCA or CLI `--remote`. Task type determines the handoff strategy (CCA fetches events; CLI prepares a transient session). """ CCA = "cca" CLI = "cli" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModeSetRequest: """Agent interaction mode to apply to the session.""" mode: SessionMode """The session mode the agent is operating in""" @staticmethod def from_dict(obj: Any) -> 'ModeSetRequest': assert isinstance(obj, dict) mode = SessionMode(obj.get("mode")) return ModeSetRequest(mode) def to_dict(self) -> dict: result: dict = {} result["mode"] = to_enum(SessionMode, self.mode) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelBillingTokenPricesLongContext: """Long context tier pricing (available for models with extended context windows)""" cache_price: float | None = None """Use cacheReadPrice instead. AI Credits cost per billing batch of cached tokens""" cache_read_price: float | None = None """AI Credits cost per billing batch of cached (read) tokens""" cache_write_price: float | None = None """AI Credits cost per billing batch of cache-write (cache creation) tokens.""" context_max: int | None = None """Use maxPromptTokens instead. Prompt token budget for the long context tier. The total context window is this value plus the model's max_output_tokens. """ input_price: float | None = None """AI Credits cost per billing batch of input tokens""" max_prompt_tokens: int | None = None """Prompt token budget for the long context tier. The total context window is this value plus the model's max_output_tokens. """ output_price: float | None = None """AI Credits cost per billing batch of output tokens""" @staticmethod def from_dict(obj: Any) -> 'ModelBillingTokenPricesLongContext': assert isinstance(obj, dict) cache_price = from_union([from_float, from_none], obj.get("cachePrice")) cache_read_price = from_union([from_float, from_none], obj.get("cacheReadPrice")) cache_write_price = from_union([from_float, from_none], obj.get("cacheWritePrice")) context_max = from_union([from_int, from_none], obj.get("contextMax")) input_price = from_union([from_float, from_none], obj.get("inputPrice")) max_prompt_tokens = from_union([from_int, from_none], obj.get("maxPromptTokens")) output_price = from_union([from_float, from_none], obj.get("outputPrice")) return ModelBillingTokenPricesLongContext(cache_price, cache_read_price, cache_write_price, context_max, input_price, max_prompt_tokens, output_price) def to_dict(self) -> dict: result: dict = {} if self.cache_price is not None: result["cachePrice"] = from_union([to_float, from_none], self.cache_price) if self.cache_read_price is not None: result["cacheReadPrice"] = from_union([to_float, from_none], self.cache_read_price) if self.cache_write_price is not None: result["cacheWritePrice"] = from_union([to_float, from_none], self.cache_write_price) if self.context_max is not None: result["contextMax"] = from_union([from_int, from_none], self.context_max) if self.input_price is not None: result["inputPrice"] = from_union([to_float, from_none], self.input_price) if self.max_prompt_tokens is not None: result["maxPromptTokens"] = from_union([from_int, from_none], self.max_prompt_tokens) if self.output_price is not None: result["outputPrice"] = from_union([to_float, from_none], self.output_price) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesLimitsVision: """Vision-specific limits""" max_prompt_image_size: int """Maximum image size in bytes""" max_prompt_images: int """Maximum number of images per prompt""" supported_media_types: list[str] """MIME types the model accepts""" @staticmethod def from_dict(obj: Any) -> 'ModelCapabilitiesLimitsVision': assert isinstance(obj, dict) max_prompt_image_size = from_int(obj.get("max_prompt_image_size")) max_prompt_images = from_int(obj.get("max_prompt_images")) supported_media_types = from_list(from_str, obj.get("supported_media_types")) return ModelCapabilitiesLimitsVision(max_prompt_image_size, max_prompt_images, supported_media_types) def to_dict(self) -> dict: result: dict = {} result["max_prompt_image_size"] = from_int(self.max_prompt_image_size) result["max_prompt_images"] = from_int(self.max_prompt_images) result["supported_media_types"] = from_list(from_str, self.supported_media_types) return result # Experimental: this type is part of an experimental API and may change or be removed. class ModelPickerPriceCategory(Enum): """Relative cost tier for token-based billing users""" HIGH = "high" LOW = "low" MEDIUM = "medium" VERY_HIGH = "very_high" # Experimental: this type is part of an experimental API and may change or be removed. class ModelPolicyState(Enum): """Current policy state for this model""" DISABLED = "disabled" ENABLED = "enabled" UNCONFIGURED = "unconfigured" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideLimitsVision: """Vision-specific limits""" max_prompt_image_size: int | None = None """Maximum image size in bytes""" max_prompt_images: int | None = None """Maximum number of images per prompt""" supported_media_types: list[str] | None = None """MIME types the model accepts""" @staticmethod def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideLimitsVision': assert isinstance(obj, dict) max_prompt_image_size = from_union([from_int, from_none], obj.get("max_prompt_image_size")) max_prompt_images = from_union([from_int, from_none], obj.get("max_prompt_images")) supported_media_types = from_union([lambda x: from_list(from_str, x), from_none], obj.get("supported_media_types")) return ModelCapabilitiesOverrideLimitsVision(max_prompt_image_size, max_prompt_images, supported_media_types) def to_dict(self) -> dict: result: dict = {} if self.max_prompt_image_size is not None: result["max_prompt_image_size"] = from_union([from_int, from_none], self.max_prompt_image_size) if self.max_prompt_images is not None: result["max_prompt_images"] = from_union([from_int, from_none], self.max_prompt_images) if self.supported_media_types is not None: result["supported_media_types"] = from_union([lambda x: from_list(from_str, x), from_none], self.supported_media_types) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelListRequest: """Optional listing options.""" skip_cache: bool | None = None """If true, bypasses the per-session model list cache and re-fetches from CAPI.""" @staticmethod def from_dict(obj: Any) -> 'ModelListRequest': assert isinstance(obj, dict) skip_cache = from_union([from_bool, from_none], obj.get("skipCache")) return ModelListRequest(skip_cache) def to_dict(self) -> dict: result: dict = {} if self.skip_cache is not None: result["skipCache"] = from_union([from_bool, from_none], self.skip_cache) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSetReasoningEffortRequest: """Reasoning effort level to apply to the currently selected model.""" reasoning_effort: str """Reasoning effort level to apply to the currently selected model. The host is responsible for validating the value against the model's supported levels before calling. """ @staticmethod def from_dict(obj: Any) -> 'ModelSetReasoningEffortRequest': assert isinstance(obj, dict) reasoning_effort = from_str(obj.get("reasoningEffort")) return ModelSetReasoningEffortRequest(reasoning_effort) def to_dict(self) -> dict: result: dict = {} result["reasoningEffort"] = from_str(self.reasoning_effort) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSetReasoningEffortResult: """Update the session's reasoning effort without changing the selected model. Use `switchTo` instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns. """ reasoning_effort: str """Reasoning effort level recorded on the session after the update""" @staticmethod def from_dict(obj: Any) -> 'ModelSetReasoningEffortResult': assert isinstance(obj, dict) reasoning_effort = from_str(obj.get("reasoningEffort")) return ModelSetReasoningEffortResult(reasoning_effort) def to_dict(self) -> dict: result: dict = {} result["reasoningEffort"] = from_str(self.reasoning_effort) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSwitchToResult: """The model identifier active on the session after the switch.""" model_id: str | None = None """Currently active model identifier after the switch""" @staticmethod def from_dict(obj: Any) -> 'ModelSwitchToResult': assert isinstance(obj, dict) model_id = from_union([from_str, from_none], obj.get("modelId")) return ModelSwitchToResult(model_id) def to_dict(self) -> dict: result: dict = {} if self.model_id is not None: result["modelId"] = from_union([from_str, from_none], self.model_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelsListRequest: git_hub_token: str | None = None """GitHub token for per-user model listing. When provided, resolves this token to determine the user's Copilot plan and available models instead of using the global auth. """ @staticmethod def from_dict(obj: Any) -> 'ModelsListRequest': assert isinstance(obj, dict) git_hub_token = from_union([from_str, from_none], obj.get("gitHubToken")) return ModelsListRequest(git_hub_token) def to_dict(self) -> dict: result: dict = {} if self.git_hub_token is not None: result["gitHubToken"] = from_union([from_str, from_none], self.git_hub_token) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameGetResult: """The session's friendly name, or null when not yet set.""" name: str | None = None """The session name (user-set or auto-generated), or null if not yet set""" @staticmethod def from_dict(obj: Any) -> 'NameGetResult': assert isinstance(obj, dict) name = from_union([from_none, from_str], obj.get("name")) return NameGetResult(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_union([from_none, from_str], self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetAutoRequest: """Auto-generated session summary to apply as the session's name when no user-set name exists. """ summary: str """Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. """ @staticmethod def from_dict(obj: Any) -> 'NameSetAutoRequest': assert isinstance(obj, dict) summary = from_str(obj.get("summary")) return NameSetAutoRequest(summary) def to_dict(self) -> dict: result: dict = {} result["summary"] = from_str(self.summary) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetAutoResult: """Indicates whether the auto-generated summary was applied as the session's name.""" applied: bool """Whether the auto-generated summary was persisted. False if the session already has a user-set name, the summary normalized to empty, or the session does not have a workspace. """ @staticmethod def from_dict(obj: Any) -> 'NameSetAutoResult': assert isinstance(obj, dict) applied = from_bool(obj.get("applied")) return NameSetAutoResult(applied) def to_dict(self) -> dict: result: dict = {} result["applied"] = from_bool(self.applied) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetRequest: """New friendly name to apply to the session.""" name: str """New session name (1–100 characters, trimmed of leading/trailing whitespace)""" @staticmethod def from_dict(obj: Any) -> 'NameSetRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return NameSetRequest(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderConfigAzure: """Azure-specific provider options.""" api_version: str | None = None """API version. When set, uses the versioned deployment route. When omitted, uses the GA versionless v1 route. """ @staticmethod def from_dict(obj: Any) -> 'ProviderConfigAzure': assert isinstance(obj, dict) api_version = from_union([from_str, from_none], obj.get("apiVersion")) return ProviderConfigAzure(api_version) def to_dict(self) -> dict: result: dict = {} if self.api_version is not None: result["apiVersion"] = from_union([from_str, from_none], self.api_version) return result # Experimental: this type is part of an experimental API and may change or be removed. class ProviderTransport(Enum): """Provider transport. Defaults to "http". Transport to be used for provider requests. """ HTTP = "http" WEBSOCKETS = "websockets" # Experimental: this type is part of an experimental API and may change or be removed. class ProviderType(Enum): """Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. Provider family. Matches the `type` field of a BYOK provider config. """ ANTHROPIC = "anthropic" AZURE = "azure" OPENAI = "openai" # Experimental: this type is part of an experimental API and may change or be removed. class ProviderWireAPI(Enum): """Wire API format (openai/azure only). Defaults to "completions". Wire API to be used, when required for the provider type. """ COMPLETIONS = "completions" RESPONSES = "responses" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class OptionsUpdateAdditionalContentExclusionPolicyRuleSource: """Schema for the `OptionsUpdateAdditionalContentExclusionPolicyRuleSource` type.""" name: str type: str @staticmethod def from_dict(obj: Any) -> 'OptionsUpdateAdditionalContentExclusionPolicyRuleSource': assert isinstance(obj, dict) name = from_str(obj.get("name")) type = from_str(obj.get("type")) return OptionsUpdateAdditionalContentExclusionPolicyRuleSource(name, type) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["type"] = from_str(self.type) return result # Experimental: this type is part of an experimental API and may change or be removed. class AdditionalContentExclusionPolicyScope(Enum): """Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration. Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. Allowed values for the `SessionOpenOptionsAdditionalContentExclusionPolicyScope` enumeration. """ ALL = "all" REPO = "repo" # Experimental: this type is part of an experimental API and may change or be removed. class OptionsUpdateContextTier(Enum): """Context tier for models with tiered pricing. The session uses this to derive effective `modelCapabilitiesOverrides` so compaction, truncation, token display, and request limits honor the selected tier. """ DEFAULT = "default" LONG_CONTEXT = "long_context" # Experimental: this type is part of an experimental API and may change or be removed. class OptionsUpdateToolFilterPrecedence(Enum): """Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. """ AVAILABLE = "available" EXCLUDED = "excluded" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PendingPermissionRequest: """Schema for the `PendingPermissionRequest` type.""" request: PermissionPromptRequest """The user-facing permission prompt details (commands, write, read, mcp, url, memory, custom-tool, path, hook) """ request_id: str """Unique identifier for the pending permission request""" @staticmethod def from_dict(obj: Any) -> 'PendingPermissionRequest': assert isinstance(obj, dict) request = PermissionPromptRequest.from_dict(obj.get("request")) request_id = from_str(obj.get("requestId")) return PendingPermissionRequest(request, request_id) def to_dict(self) -> dict: result: dict = {} result["request"] = to_class(PermissionPromptRequest, self.request) result["requestId"] = from_str(self.request_id) return result class ApprovalKind(Enum): COMMANDS = "commands" CUSTOM_TOOL = "custom-tool" EXTENSION_MANAGEMENT = "extension-management" EXTENSION_PERMISSION_ACCESS = "extension-permission-access" MCP = "mcp" MCP_SAMPLING = "mcp-sampling" MEMORY = "memory" READ = "read" WRITE = "write" class PermissionDecisionKind(Enum): APPROVED = "approved" APPROVED_FOR_LOCATION = "approved-for-location" APPROVED_FOR_SESSION = "approved-for-session" APPROVE_FOR_LOCATION = "approve-for-location" APPROVE_FOR_SESSION = "approve-for-session" APPROVE_ONCE = "approve-once" APPROVE_PERMANENTLY = "approve-permanently" CANCELLED = "cancelled" DENIED_BY_CONTENT_EXCLUSION_POLICY = "denied-by-content-exclusion-policy" DENIED_BY_PERMISSION_REQUEST_HOOK = "denied-by-permission-request-hook" DENIED_BY_RULES = "denied-by-rules" DENIED_INTERACTIVELY_BY_USER = "denied-interactively-by-user" DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = "denied-no-approval-rule-and-could-not-request-from-user" REJECT = "reject" USER_NOT_AVAILABLE = "user-not-available" class PermissionDecisionApproveForLocationKind(Enum): APPROVE_FOR_LOCATION = "approve-for-location" class PermissionDecisionApproveForLocationApprovalCommandsKind(Enum): COMMANDS = "commands" class PermissionDecisionApproveForLocationApprovalCustomToolKind(Enum): CUSTOM_TOOL = "custom-tool" class PermissionDecisionApproveForLocationApprovalExtensionManagementKind(Enum): EXTENSION_MANAGEMENT = "extension-management" class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccessKind(Enum): EXTENSION_PERMISSION_ACCESS = "extension-permission-access" class PermissionDecisionApproveForLocationApprovalMCPKind(Enum): MCP = "mcp" class PermissionDecisionApproveForLocationApprovalMCPSamplingKind(Enum): MCP_SAMPLING = "mcp-sampling" class PermissionDecisionApproveForLocationApprovalMemoryKind(Enum): MEMORY = "memory" class PermissionDecisionApproveForLocationApprovalReadKind(Enum): READ = "read" class PermissionDecisionApproveForLocationApprovalWriteKind(Enum): WRITE = "write" class PermissionDecisionApproveForSessionKind(Enum): APPROVE_FOR_SESSION = "approve-for-session" class PermissionDecisionApproveOnceKind(Enum): APPROVE_ONCE = "approve-once" class PermissionDecisionApprovePermanentlyKind(Enum): APPROVE_PERMANENTLY = "approve-permanently" class PermissionDecisionApprovedKind(Enum): APPROVED = "approved" class PermissionDecisionApprovedForLocationKind(Enum): APPROVED_FOR_LOCATION = "approved-for-location" class PermissionDecisionApprovedForSessionKind(Enum): APPROVED_FOR_SESSION = "approved-for-session" class PermissionDecisionCancelledKind(Enum): CANCELLED = "cancelled" class PermissionDecisionDeniedByContentExclusionPolicyKind(Enum): DENIED_BY_CONTENT_EXCLUSION_POLICY = "denied-by-content-exclusion-policy" class PermissionDecisionDeniedByPermissionRequestHookKind(Enum): DENIED_BY_PERMISSION_REQUEST_HOOK = "denied-by-permission-request-hook" class PermissionDecisionDeniedByRulesKind(Enum): DENIED_BY_RULES = "denied-by-rules" class PermissionDecisionDeniedInteractivelyByUserKind(Enum): DENIED_INTERACTIVELY_BY_USER = "denied-interactively-by-user" class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind(Enum): DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = "denied-no-approval-rule-and-could-not-request-from-user" class PermissionDecisionRejectKind(Enum): REJECT = "reject" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionRequest: """Pending permission request ID and the decision to apply (approve/reject and scope).""" request_id: str """Request ID of the pending permission request""" result: PermissionDecision """The client's response to the pending permission prompt""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = _load_PermissionDecision(obj.get("result")) return PermissionDecisionRequest(request_id, result) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["result"] = (self.result).to_dict() return result class PermissionDecisionUserNotAvailableKind(Enum): USER_NOT_AVAILABLE = "user-not-available" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationApplyParams: """Working directory to load persisted location permissions for.""" working_directory: str """Working directory whose persisted location permissions should be applied""" @staticmethod def from_dict(obj: Any) -> 'PermissionLocationApplyParams': assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return PermissionLocationApplyParams(working_directory) def to_dict(self) -> dict: result: dict = {} result["workingDirectory"] = from_str(self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. class PermissionLocationType(Enum): """Whether the location is a git repo or directory""" DIR = "dir" REPO = "repo" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationResolveParams: """Working directory to resolve into a location-permissions key.""" working_directory: str """Working directory whose permission location should be resolved""" @staticmethod def from_dict(obj: Any) -> 'PermissionLocationResolveParams': assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return PermissionLocationResolveParams(working_directory) def to_dict(self) -> dict: result: dict = {} result["workingDirectory"] = from_str(self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAddParams: """Directory path to add to the session's allowed directories.""" path: str """Directory to add to the allow-list. The runtime resolves and validates the path before adding. """ @staticmethod def from_dict(obj: Any) -> 'PermissionPathsAddParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsAddParams(path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAllowedCheckParams: """Path to evaluate against the session's allowed directories.""" path: str """Path to check against the session's allowed directories""" @staticmethod def from_dict(obj: Any) -> 'PermissionPathsAllowedCheckParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsAllowedCheckParams(path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAllowedCheckResult: """Indicates whether the supplied path is within the session's allowed directories.""" allowed: bool """Whether the path is within the session's allowed directories""" @staticmethod def from_dict(obj: Any) -> 'PermissionPathsAllowedCheckResult': assert isinstance(obj, dict) allowed = from_bool(obj.get("allowed")) return PermissionPathsAllowedCheckResult(allowed) def to_dict(self) -> dict: result: dict = {} result["allowed"] = from_bool(self.allowed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsList: """Snapshot of the session's allow-listed directories and primary working directory.""" directories: list[str] """All directories currently allowed for tool access on this session.""" primary: str """The primary working directory for this session.""" @staticmethod def from_dict(obj: Any) -> 'PermissionPathsList': assert isinstance(obj, dict) directories = from_list(from_str, obj.get("directories")) primary = from_str(obj.get("primary")) return PermissionPathsList(directories, primary) def to_dict(self) -> dict: result: dict = {} result["directories"] = from_list(from_str, self.directories) result["primary"] = from_str(self.primary) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsUpdatePrimaryParams: """Directory path to set as the session's new primary working directory.""" path: str """Directory to set as the new primary working directory for the session's permission policy.""" @staticmethod def from_dict(obj: Any) -> 'PermissionPathsUpdatePrimaryParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsUpdatePrimaryParams(path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsWorkspaceCheckParams: """Path to evaluate against the session's workspace (primary) directory.""" path: str """Path to check against the session workspace directory""" @staticmethod def from_dict(obj: Any) -> 'PermissionPathsWorkspaceCheckParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsWorkspaceCheckParams(path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsWorkspaceCheckResult: """Indicates whether the supplied path is within the session's workspace directory.""" allowed: bool """Whether the path is within the session workspace directory""" @staticmethod def from_dict(obj: Any) -> 'PermissionPathsWorkspaceCheckResult': assert isinstance(obj, dict) allowed = from_bool(obj.get("allowed")) return PermissionPathsWorkspaceCheckResult(allowed) def to_dict(self) -> dict: result: dict = {} result["allowed"] = from_bool(self.allowed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPromptShownNotification: """Notification payload describing the permission prompt that the client just rendered.""" message: str """Human-readable description of the prompt the user is being asked to approve. Used by the runtime to fire the registered `permission_prompt` notification hook (e.g. terminal bell, desktop notification). """ @staticmethod def from_dict(obj: Any) -> 'PermissionPromptShownNotification': assert isinstance(obj, dict) message = from_str(obj.get("message")) return PermissionPromptShownNotification(message) def to_dict(self) -> dict: result: dict = {} result["message"] = from_str(self.message) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionRequestResult: """Indicates whether the permission decision was applied; false when the request was already resolved. """ success: bool """Whether the permission request was handled successfully""" @staticmethod def from_dict(obj: Any) -> 'PermissionRequestResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionRequestResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionRulesSet: """If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. """ approved: list[PermissionRule] """Rules that auto-approve matching requests""" denied: list[PermissionRule] """Rules that auto-deny matching requests""" @staticmethod def from_dict(obj: Any) -> 'PermissionRulesSet': assert isinstance(obj, dict) approved = from_list(PermissionRule.from_dict, obj.get("approved")) denied = from_list(PermissionRule.from_dict, obj.get("denied")) return PermissionRulesSet(approved, denied) def to_dict(self) -> dict: result: dict = {} result["approved"] = from_list(lambda x: to_class(PermissionRule, x), self.approved) result["denied"] = from_list(lambda x: to_class(PermissionRule, x), self.denied) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionUrlsConfig: """If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. """ initial_allowed: list[str] | None = None """Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. """ unrestricted: bool | None = None """If true, the runtime allows access to all URLs without prompting. Initial allow-list is ignored when this is true. """ @staticmethod def from_dict(obj: Any) -> 'PermissionUrlsConfig': assert isinstance(obj, dict) initial_allowed = from_union([lambda x: from_list(from_str, x), from_none], obj.get("initialAllowed")) unrestricted = from_union([from_bool, from_none], obj.get("unrestricted")) return PermissionUrlsConfig(initial_allowed, unrestricted) def to_dict(self) -> dict: result: dict = {} if self.initial_allowed is not None: result["initialAllowed"] = from_union([lambda x: from_list(from_str, x), from_none], self.initial_allowed) if self.unrestricted is not None: result["unrestricted"] = from_union([from_bool, from_none], self.unrestricted) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionUrlsSetUnrestrictedModeParams: """Whether the URL-permission policy should run in unrestricted mode.""" enabled: bool """Whether to allow access to all URLs without prompting. Toggles the runtime's URL-permission policy in place. """ @staticmethod def from_dict(obj: Any) -> 'PermissionUrlsSetUnrestrictedModeParams': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) return PermissionUrlsSetUnrestrictedModeParams(enabled) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicyRuleSource: """Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRuleSource` type.""" name: str type: str @staticmethod def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicyRuleSource': assert isinstance(obj, dict) name = from_str(obj.get("name")) type = from_str(obj.get("type")) return PermissionsConfigureAdditionalContentExclusionPolicyRuleSource(name, type) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["type"] = from_str(self.type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsConfigureResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsConfigureResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsFolderTrustAddTrustedResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsFolderTrustAddTrustedResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsFolderTrustAddTrustedResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsGetAllowAllRequest: """No parameters.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsGetAllowAllRequest': assert isinstance(obj, dict) return PermissionsGetAllowAllRequest() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsLocationsAddToolApprovalResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. class PermissionsModifyRulesScope(Enum): """Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. """ LOCATION = "location" SESSION = "session" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsModifyRulesResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsModifyRulesResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsModifyRulesResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsNotifyPromptShownResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsNotifyPromptShownResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsNotifyPromptShownResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsAddResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsPathsAddResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsPathsAddResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsListRequest: """No parameters; returns the session's allow-listed directories.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsPathsListRequest': assert isinstance(obj, dict) return PermissionsPathsListRequest() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsUpdatePrimaryResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsPathsUpdatePrimaryResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsPathsUpdatePrimaryResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPendingRequestsRequest: """No parameters; returns currently-pending permission requests for the session.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsPendingRequestsRequest': assert isinstance(obj, dict) return PermissionsPendingRequestsRequest() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsResetSessionApprovalsRequest: """No parameters; clears all session-scoped tool permission approvals.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsResetSessionApprovalsRequest': assert isinstance(obj, dict) return PermissionsResetSessionApprovalsRequest() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsResetSessionApprovalsResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsResetSessionApprovalsResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsResetSessionApprovalsResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetApproveAllResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsSetApproveAllResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsSetApproveAllResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetRequiredRequest: """Toggles whether permission prompts should be bridged into session events for this client.""" required: bool """Whether the client wants `permission.requested` events bridged from the session-owned permission service. CLI clients that render prompt UI set this to `true` for as long as their listener is mounted; headless callers leave it unset (the default is `false`). """ @staticmethod def from_dict(obj: Any) -> 'PermissionsSetRequiredRequest': assert isinstance(obj, dict) required = from_bool(obj.get("required")) return PermissionsSetRequiredRequest(required) def to_dict(self) -> dict: result: dict = {} result["required"] = from_bool(self.required) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetRequiredResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsSetRequiredResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsSetRequiredResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsUrlsSetUnrestrictedModeResult: """Indicates whether the operation succeeded.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'PermissionsUrlsSetUnrestrictedModeResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsUrlsSetUnrestrictedModeResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PingRequest: """Optional message to echo back to the caller.""" message: str | None = None """Optional message to echo back""" @staticmethod def from_dict(obj: Any) -> 'PingRequest': assert isinstance(obj, dict) message = from_union([from_str, from_none], obj.get("message")) return PingRequest(message) def to_dict(self) -> dict: result: dict = {} if self.message is not None: result["message"] = from_union([from_str, from_none], self.message) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PingResult: """Server liveness response, including the echoed message, current server timestamp, and protocol version. """ message: str """Echoed message (or default greeting)""" protocol_version: int """Server protocol version number""" timestamp: datetime """ISO 8601 timestamp when the server handled the ping""" @staticmethod def from_dict(obj: Any) -> 'PingResult': assert isinstance(obj, dict) message = from_str(obj.get("message")) protocol_version = from_int(obj.get("protocolVersion")) timestamp = from_datetime(obj.get("timestamp")) return PingResult(message, protocol_version, timestamp) def to_dict(self) -> dict: result: dict = {} result["message"] = from_str(self.message) result["protocolVersion"] = from_int(self.protocol_version) result["timestamp"] = self.timestamp.isoformat() return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanReadResult: """Existence, contents, and resolved path of the session plan file.""" exists: bool """Whether the plan file exists in the workspace""" content: str | None = None """The content of the plan file, or null if it does not exist""" path: str | None = None """Absolute file path of the plan file, or null if workspace is not enabled""" @staticmethod def from_dict(obj: Any) -> 'PlanReadResult': assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) content = from_union([from_none, from_str], obj.get("content")) path = from_union([from_none, from_str], obj.get("path")) return PlanReadResult(exists, content, path) def to_dict(self) -> dict: result: dict = {} result["exists"] = from_bool(self.exists) result["content"] = from_union([from_none, from_str], self.content) result["path"] = from_union([from_none, from_str], self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanSQLTodosRow: """A single todo row read from the session SQL `todos` table. All fields are optional because the SQL schema is best-effort and the agent may not have populated every column. """ description: str | None = None """Todo description.""" id: str | None = None """Todo identifier.""" status: str | None = None """Todo status.""" title: str | None = None """Todo title.""" @staticmethod def from_dict(obj: Any) -> 'PlanSQLTodosRow': assert isinstance(obj, dict) description = from_union([from_str, from_none], obj.get("description")) id = from_union([from_str, from_none], obj.get("id")) status = from_union([from_str, from_none], obj.get("status")) title = from_union([from_str, from_none], obj.get("title")) return PlanSQLTodosRow(description, id, status, title) def to_dict(self) -> dict: result: dict = {} if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.id is not None: result["id"] = from_union([from_str, from_none], self.id) if self.status is not None: result["status"] = from_union([from_str, from_none], self.status) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanSQLTodoDependency: """A single dependency edge read from the session SQL `todo_deps` table, indicating that one todo must complete before another. """ depends_on: str """ID of the todo it depends on.""" todo_id: str """ID of the todo that has the dependency.""" @staticmethod def from_dict(obj: Any) -> 'PlanSQLTodoDependency': assert isinstance(obj, dict) depends_on = from_str(obj.get("dependsOn")) todo_id = from_str(obj.get("todoId")) return PlanSQLTodoDependency(depends_on, todo_id) def to_dict(self) -> dict: result: dict = {} result["dependsOn"] = from_str(self.depends_on) result["todoId"] = from_str(self.todo_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanUpdateRequest: """Replacement contents to write to the session plan file.""" content: str """The new content for the plan file""" @staticmethod def from_dict(obj: Any) -> 'PlanUpdateRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) return PlanUpdateRequest(content) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Plugin: """Schema for the `Plugin` type.""" enabled: bool """Whether the plugin is currently enabled""" marketplace: str """Marketplace the plugin came from""" name: str """Plugin name""" version: str | None = None """Installed version""" @staticmethod def from_dict(obj: Any) -> 'Plugin': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) version = from_union([from_str, from_none], obj.get("version")) return Plugin(enabled, marketplace, name, version) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) result["marketplace"] = from_str(self.marketplace) result["name"] = from_str(self.name) if self.version is not None: result["version"] = from_union([from_str, from_none], self.version) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginUpdateResult: """Result of updating a single plugin.""" skills_installed: int """Number of skills discovered and installed after the update""" new_version: str | None = None """Version after the update, when reported by the plugin manifest""" previous_version: str | None = None """Version that was previously installed, when available""" @staticmethod def from_dict(obj: Any) -> 'PluginUpdateResult': assert isinstance(obj, dict) skills_installed = from_int(obj.get("skillsInstalled")) new_version = from_union([from_str, from_none], obj.get("newVersion")) previous_version = from_union([from_str, from_none], obj.get("previousVersion")) return PluginUpdateResult(skills_installed, new_version, previous_version) def to_dict(self) -> dict: result: dict = {} result["skillsInstalled"] = from_int(self.skills_installed) if self.new_version is not None: result["newVersion"] = from_union([from_str, from_none], self.new_version) if self.previous_version is not None: result["previousVersion"] = from_union([from_str, from_none], self.previous_version) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsMarketplacesAddRequest: """Marketplace source to register.""" source: str """Marketplace source. Accepts the same forms as the CLI: "owner/repo" or "owner/repo#ref" (GitHub), an http/https/ssh URL (optionally with #ref), a git scp-style URL (user@host:path), or a local path. The marketplace's own name (from its manifest) is used as the registration key. """ @staticmethod def from_dict(obj: Any) -> 'PluginsMarketplacesAddRequest': assert isinstance(obj, dict) source = from_str(obj.get("source")) return PluginsMarketplacesAddRequest(source) def to_dict(self) -> dict: result: dict = {} result["source"] = from_str(self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsMarketplacesBrowseRequest: """Name of the marketplace whose plugin catalog to fetch.""" name: str """Marketplace name to browse""" @staticmethod def from_dict(obj: Any) -> 'PluginsMarketplacesBrowseRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return PluginsMarketplacesBrowseRequest(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsMarketplacesRefreshRequest: name: str | None = None """Marketplace name to refresh. When omitted, every registered marketplace is refreshed.""" @staticmethod def from_dict(obj: Any) -> 'PluginsMarketplacesRefreshRequest': assert isinstance(obj, dict) name = from_union([from_str, from_none], obj.get("name")) return PluginsMarketplacesRefreshRequest(name) def to_dict(self) -> dict: result: dict = {} if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsMarketplacesRemoveRequest: """Name of the marketplace to remove and an optional force flag.""" name: str """Marketplace name to remove""" force: bool | None = None """When true, also uninstall every plugin sourced from this marketplace. When false (default), removal is a no-op if any plugin from this marketplace is installed and the dependent plugin names are returned in the result. """ @staticmethod def from_dict(obj: Any) -> 'PluginsMarketplacesRemoveRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) force = from_union([from_bool, from_none], obj.get("force")) return PluginsMarketplacesRemoveRequest(name, force) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) if self.force is not None: result["force"] = from_union([from_bool, from_none], self.force) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsReloadRequest: """Optional flags controlling which side effects the reload performs.""" defer_repo_hooks: bool | None = None """When true, skip repo-level hooks during the hook reload. Use before folder trust is confirmed; load them post-trust via `sessions.loadDeferredRepoHooks`. """ reload_custom_agents: bool | None = None """Re-run custom-agent discovery after refreshing plugins. Defaults to true.""" reload_hooks: bool | None = None """Re-load user, plugin, and (subject to `deferRepoHooks`) repo hooks. Defaults to true. Has no effect when the host has not registered a hook reloader (e.g. remote sessions). """ reload_mcp: bool | None = None """Reload MCP server connections after refreshing plugins. Defaults to true.""" @staticmethod def from_dict(obj: Any) -> 'PluginsReloadRequest': assert isinstance(obj, dict) defer_repo_hooks = from_union([from_bool, from_none], obj.get("deferRepoHooks")) reload_custom_agents = from_union([from_bool, from_none], obj.get("reloadCustomAgents")) reload_hooks = from_union([from_bool, from_none], obj.get("reloadHooks")) reload_mcp = from_union([from_bool, from_none], obj.get("reloadMcp")) return PluginsReloadRequest(defer_repo_hooks, reload_custom_agents, reload_hooks, reload_mcp) def to_dict(self) -> dict: result: dict = {} if self.defer_repo_hooks is not None: result["deferRepoHooks"] = from_union([from_bool, from_none], self.defer_repo_hooks) if self.reload_custom_agents is not None: result["reloadCustomAgents"] = from_union([from_bool, from_none], self.reload_custom_agents) if self.reload_hooks is not None: result["reloadHooks"] = from_union([from_bool, from_none], self.reload_hooks) if self.reload_mcp is not None: result["reloadMcp"] = from_union([from_bool, from_none], self.reload_mcp) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsPollSpawnedSessionsEvent: """Schema for the `SessionsPollSpawnedSessionsEvent` type.""" session_id: str """Session id of the newly-spawned session.""" @staticmethod def from_dict(obj: Any) -> 'SessionsPollSpawnedSessionsEvent': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsPollSpawnedSessionsEvent(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderAddResult: """The selectable model entries synthesized for the models added by this call.""" models: list[Any] """Synthesized selectable model entries for the newly added BYOK models, each under its provider-qualified selection id (`provider/id`). Empty when only providers were added. """ @staticmethod def from_dict(obj: Any) -> 'ProviderAddResult': assert isinstance(obj, dict) models = from_list(lambda x: x, obj.get("models")) return ProviderAddResult(models) def to_dict(self) -> dict: result: dict = {} result["models"] = from_list(lambda x: x, self.models) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderSessionToken: """Short-lived, rotating credential the caller must send on every request, in addition to `apiKey` if one is present. Omitted when the endpoint does not require one. """ header: str """HTTP header name the token must be sent under.""" token: str """The short-lived token value.""" expires_at: datetime | None = None """When the token expires, if known. Callers should refresh by calling `getEndpoint` again before this time, or reactively on any 401/403 response from `baseUrl`. """ model: str | None = None """The model the token is bound to, when applicable. When set, the token is only valid for requests against this model. """ @staticmethod def from_dict(obj: Any) -> 'ProviderSessionToken': assert isinstance(obj, dict) header = from_str(obj.get("header")) token = from_str(obj.get("token")) expires_at = from_union([from_datetime, from_none], obj.get("expiresAt")) model = from_union([from_str, from_none], obj.get("model")) return ProviderSessionToken(header, token, expires_at, model) def to_dict(self) -> dict: result: dict = {} result["header"] = from_str(self.header) result["token"] = from_str(self.token) if self.expires_at is not None: result["expiresAt"] = from_union([lambda x: x.isoformat(), from_none], self.expires_at) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderTokenAcquireResult: """A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer ` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. """ token: str """The bearer token value (without the `Bearer ` prefix).""" @staticmethod def from_dict(obj: Any) -> 'ProviderTokenAcquireResult': assert isinstance(obj, dict) token = from_str(obj.get("token")) return ProviderTokenAcquireResult(token) def to_dict(self) -> dict: result: dict = {} result["token"] = from_str(self.token) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushGitHubRepoRef: """Repository the commit belongs to Pointer to a GitHub repository. Repository the release belongs to Repository the workflow run belongs to Repository pointer Repository the file lives in Repository the revision belongs to """ name: str """Repository name (without owner)""" owner: str """Repository owner login (user or organization)""" id: int | None = None """Numeric GitHub repository id""" @staticmethod def from_dict(obj: Any) -> 'PushGitHubRepoRef': assert isinstance(obj, dict) name = from_str(obj.get("name")) owner = from_str(obj.get("owner")) id = from_union([from_int, from_none], obj.get("id")) return PushGitHubRepoRef(name, owner, id) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["owner"] = from_str(self.owner) if self.id is not None: result["id"] = from_union([from_int, from_none], self.id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentFileLineRange: """Optional line range to scope the attachment to a specific section of the file Line range the snippet covers """ end: int """End line number (1-based, inclusive)""" start: int """Start line number (1-based)""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentFileLineRange': assert isinstance(obj, dict) end = from_int(obj.get("end")) start = from_int(obj.get("start")) return PushAttachmentFileLineRange(end, start) def to_dict(self) -> dict: result: dict = {} result["end"] = from_int(self.end) result["start"] = from_int(self.start) return result class PushAttachmentGitHubReferenceTypeEnum(Enum): """Type of GitHub reference""" DISCUSSION = "discussion" ISSUE = "issue" PR = "pr" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentSelectionDetailsEnd: """End position of the selection""" character: int """End character offset within the line (0-based)""" line: int """End line number (0-based)""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentSelectionDetailsEnd': assert isinstance(obj, dict) character = from_int(obj.get("character")) line = from_int(obj.get("line")) return PushAttachmentSelectionDetailsEnd(character, line) def to_dict(self) -> dict: result: dict = {} result["character"] = from_int(self.character) result["line"] = from_int(self.line) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentSelectionDetailsStart: """Start position of the selection""" character: int """Start character offset within the line (0-based)""" line: int """Start line number (0-based)""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentSelectionDetailsStart': assert isinstance(obj, dict) character = from_int(obj.get("character")) line = from_int(obj.get("line")) return PushAttachmentSelectionDetailsStart(character, line) def to_dict(self) -> dict: result: dict = {} result["character"] = from_int(self.character) result["line"] = from_int(self.line) return result class PushAttachmentType(Enum): BLOB = "blob" DIRECTORY = "directory" EXTENSION_CONTEXT = "extension_context" FILE = "file" GITHUB_ACTIONS_JOB = "github_actions_job" GITHUB_COMMIT = "github_commit" GITHUB_FILE = "github_file" GITHUB_FILE_DIFF = "github_file_diff" GITHUB_REFERENCE = "github_reference" GITHUB_RELEASE = "github_release" GITHUB_REPOSITORY = "github_repository" GITHUB_SNIPPET = "github_snippet" GITHUB_TREE_COMPARISON = "github_tree_comparison" GITHUB_URL = "github_url" SELECTION = "selection" class PushAttachmentBlobType(Enum): BLOB = "blob" class PushAttachmentFileType(Enum): FILE = "file" class PushAttachmentGitHubActionsJobType(Enum): GITHUB_ACTIONS_JOB = "github_actions_job" class PushAttachmentGitHubCommitType(Enum): GITHUB_COMMIT = "github_commit" class PushAttachmentGitHubFileType(Enum): GITHUB_FILE = "github_file" class PushAttachmentGitHubFileDiffType(Enum): GITHUB_FILE_DIFF = "github_file_diff" # Experimental: this type is part of an experimental API and may change or be removed. class PushAttachmentGitHubReferenceType(Enum): GITHUB_REFERENCE = "github_reference" class PushAttachmentGitHubReleaseType(Enum): GITHUB_RELEASE = "github_release" class PushAttachmentGitHubRepositoryType(Enum): GITHUB_REPOSITORY = "github_repository" class PushAttachmentGitHubSnippetType(Enum): GITHUB_SNIPPET = "github_snippet" class PushAttachmentGitHubTreeComparisonType(Enum): GITHUB_TREE_COMPARISON = "github_tree_comparison" class PushAttachmentGitHubURLType(Enum): GITHUB_URL = "github_url" class PushAttachmentSelectionType(Enum): SELECTION = "selection" # Experimental: this type is part of an experimental API and may change or be removed. class QueuePendingItemsKind(Enum): """Whether this item is a queued user message or a queued slash command / model change""" COMMAND = "command" MESSAGE = "message" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueueRemoveMostRecentResult: """Indicates whether a user-facing pending item was removed.""" removed: bool """True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. """ @staticmethod def from_dict(obj: Any) -> 'QueueRemoveMostRecentResult': assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return QueueRemoveMostRecentResult(removed) def to_dict(self) -> dict: result: dict = {} result["removed"] = from_bool(self.removed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuedCommandHandled: """Schema for the `QueuedCommandHandled` type.""" handled: ClassVar[str] = "true" """The host actually executed the queued command.""" stop_processing_queue: bool | None = None """When true, the runtime will not process subsequent queued commands until a new request comes in. """ @staticmethod def from_dict(obj: Any) -> 'QueuedCommandHandled': assert isinstance(obj, dict) stop_processing_queue = from_union([from_bool, from_none], obj.get("stopProcessingQueue")) return QueuedCommandHandled(stop_processing_queue) def to_dict(self) -> dict: result: dict = {} result["handled"] = self.handled if self.stop_processing_queue is not None: result["stopProcessingQueue"] = from_union([from_bool, from_none], self.stop_processing_queue) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuedCommandNotHandled: """Schema for the `QueuedCommandNotHandled` type.""" handled: ClassVar[str] = "false" """The host did not execute the queued command. Unblocks the queue without claiming the command was processed (e.g. when the handler threw before completing). """ @staticmethod def from_dict(obj: Any) -> 'QueuedCommandNotHandled': assert isinstance(obj, dict) return QueuedCommandNotHandled() def to_dict(self) -> dict: result: dict = {} result["handled"] = self.handled return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RegisterEventInterestParams: """Event type to register consumer interest for, used by runtime gating logic.""" event_type: str """The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates the full interactive OAuth flow to the consumer; when no interest is registered the runtime installs a browserless fallback that silently reuses cached tokens). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `session_limits_exhausted.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`. """ @staticmethod def from_dict(obj: Any) -> 'RegisterEventInterestParams': assert isinstance(obj, dict) event_type = from_str(obj.get("eventType")) return RegisterEventInterestParams(event_type) def to_dict(self) -> dict: result: dict = {} result["eventType"] = from_str(self.event_type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RegisterEventInterestResult: """Opaque handle representing an event-type interest registration.""" handle: str """Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. """ @staticmethod def from_dict(obj: Any) -> 'RegisterEventInterestResult': assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return RegisterEventInterestResult(handle) def to_dict(self) -> dict: result: dict = {} result["handle"] = from_str(self.handle) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsRegisterExtensionToolsOnSessionOptions: """Optional registration options.""" # Internal: this field is an internal SDK API and is not part of the public surface. enabled: Any = None """In-process `() => boolean` gating callback (CLI-only optimization). Marked internal: replaced by runtime-side enable/disable RPCs in the SDK migration. """ @staticmethod def from_dict(obj: Any) -> 'SessionsRegisterExtensionToolsOnSessionOptions': assert isinstance(obj, dict) enabled = obj.get("enabled") return SessionsRegisterExtensionToolsOnSessionOptions(enabled) def to_dict(self) -> dict: result: dict = {} if self.enabled is not None: result["enabled"] = self.enabled return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ReleaseEventInterestParams: """Opaque handle previously returned by `registerInterest` to release.""" handle: str """Handle returned by a previous `registerInterest` call. Idempotent: releasing an unknown or already-released handle is a no-op (returns success). When the last outstanding handle for an event type is released, the runtime reverts to its 'no consumer' code path for that event type. """ @staticmethod def from_dict(obj: Any) -> 'ReleaseEventInterestParams': assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return ReleaseEventInterestParams(handle) def to_dict(self) -> dict: result: dict = {} result["handle"] = from_str(self.handle) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlConfigExistingMcSession: """Reattach to an existing MC session without creating a new one.""" mc_session_id: str """Existing MC session ID to reattach to.""" mc_task_id: str """Existing MC task ID for the reattached session.""" @staticmethod def from_dict(obj: Any) -> 'RemoteControlConfigExistingMcSession': assert isinstance(obj, dict) mc_session_id = from_str(obj.get("mcSessionId")) mc_task_id = from_str(obj.get("mcTaskId")) return RemoteControlConfigExistingMcSession(mc_session_id, mc_task_id) def to_dict(self) -> dict: result: dict = {} result["mcSessionId"] = from_str(self.mc_session_id) result["mcTaskId"] = from_str(self.mc_task_id) return result class RemoteControlStatusState(Enum): ACTIVE = "active" CONNECTING = "connecting" ERROR = "error" OFF = "off" class RemoteControlStatusActiveState(Enum): ACTIVE = "active" class RemoteControlStatusConnectingState(Enum): CONNECTING = "connecting" class RemoteControlStatusErrorState(Enum): ERROR = "error" class RemoteControlStatusOffState(Enum): OFF = "off" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlStatusResult: """Wrapper for the singleton's current status.""" status: RemoteControlStatus """State of the runtime-managed remote-control singleton.""" @staticmethod def from_dict(obj: Any) -> 'RemoteControlStatusResult': assert isinstance(obj, dict) status = _load_RemoteControlStatus(obj.get("status")) return RemoteControlStatusResult(status) def to_dict(self) -> dict: result: dict = {} result["status"] = (self.status).to_dict() return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlStopResult: """Outcome of a stopRemoteControl call.""" status: RemoteControlStatus """State of the runtime-managed remote-control singleton.""" stopped: bool """Whether the singleton was actually torn down by this call.""" @staticmethod def from_dict(obj: Any) -> 'RemoteControlStopResult': assert isinstance(obj, dict) status = _load_RemoteControlStatus(obj.get("status")) stopped = from_bool(obj.get("stopped")) return RemoteControlStopResult(status, stopped) def to_dict(self) -> dict: result: dict = {} result["status"] = (self.status).to_dict() result["stopped"] = from_bool(self.stopped) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlTransferResult: """Outcome of a transferRemoteControl call.""" status: RemoteControlStatus """State of the runtime-managed remote-control singleton.""" transferred: bool """Whether the rebinding actually happened.""" @staticmethod def from_dict(obj: Any) -> 'RemoteControlTransferResult': assert isinstance(obj, dict) status = _load_RemoteControlStatus(obj.get("status")) transferred = from_bool(obj.get("transferred")) return RemoteControlTransferResult(status, transferred) def to_dict(self) -> dict: result: dict = {} result["status"] = (self.status).to_dict() result["transferred"] = from_bool(self.transferred) return result # Experimental: this type is part of an experimental API and may change or be removed. class RemoteSessionMode(Enum): """Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. """ EXPORT = "export" OFF = "off" ON = "on" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteEnableResult: """GitHub URL for the session and a flag indicating whether remote steering is enabled.""" remote_steerable: bool """Whether remote steering is enabled""" url: str | None = None """GitHub frontend URL for this session""" @staticmethod def from_dict(obj: Any) -> 'RemoteEnableResult': assert isinstance(obj, dict) remote_steerable = from_bool(obj.get("remoteSteerable")) url = from_union([from_str, from_none], obj.get("url")) return RemoteEnableResult(remote_steerable, url) def to_dict(self) -> dict: result: dict = {} result["remoteSteerable"] = from_bool(self.remote_steerable) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteNotifySteerableChangedRequest: """New remote-steerability state to persist as a `session.remote_steerable_changed` event.""" remote_steerable: bool """Whether the session now supports remote steering via GitHub. The runtime persists this as a `session.remote_steerable_changed` event so resume/replay sees the up-to-date capability. """ @staticmethod def from_dict(obj: Any) -> 'RemoteNotifySteerableChangedRequest': assert isinstance(obj, dict) remote_steerable = from_bool(obj.get("remoteSteerable")) return RemoteNotifySteerableChangedRequest(remote_steerable) def to_dict(self) -> dict: result: dict = {} result["remoteSteerable"] = from_bool(self.remote_steerable) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteNotifySteerableChangedResult: """Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. """ @staticmethod def from_dict(obj: Any) -> 'RemoteNotifySteerableChangedResult': assert isinstance(obj, dict) return RemoteNotifySteerableChangedResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteSessionMetadataRepository: """GitHub repository the remote session belongs to.""" branch: str """Branch associated with the remote session.""" name: str """Repository name.""" owner: str """Repository owner.""" @staticmethod def from_dict(obj: Any) -> 'RemoteSessionMetadataRepository': assert isinstance(obj, dict) branch = from_str(obj.get("branch")) name = from_str(obj.get("name")) owner = from_str(obj.get("owner")) return RemoteSessionMetadataRepository(branch, name, owner) def to_dict(self) -> dict: result: dict = {} result["branch"] = from_str(self.branch) result["name"] = from_str(self.name) result["owner"] = from_str(self.owner) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteSessionRepository: """Repository context for the remote session. Repository for the cloud session. """ name: str """Repository name.""" owner: str """Repository owner or organization login.""" branch: str | None = None """Optional branch associated with the remote session.""" @staticmethod def from_dict(obj: Any) -> 'RemoteSessionRepository': assert isinstance(obj, dict) name = from_str(obj.get("name")) owner = from_str(obj.get("owner")) branch = from_union([from_str, from_none], obj.get("branch")) return RemoteSessionRepository(name, owner, branch) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["owner"] = from_str(self.owner) if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SandboxConfigUserPolicyExperimentalSeatbelt: """macOS seatbelt experimental options.""" keychain_access: bool | None = None """Whether the macOS seatbelt profile may access the keychain.""" @staticmethod def from_dict(obj: Any) -> 'SandboxConfigUserPolicyExperimentalSeatbelt': assert isinstance(obj, dict) keychain_access = from_union([from_bool, from_none], obj.get("keychainAccess")) return SandboxConfigUserPolicyExperimentalSeatbelt(keychain_access) def to_dict(self) -> dict: result: dict = {} if self.keychain_access is not None: result["keychainAccess"] = from_union([from_bool, from_none], self.keychain_access) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SandboxConfigUserPolicyFilesystem: """Filesystem rules to merge into the base policy.""" clear_policy_on_exit: bool | None = None """Whether to clear the policy when the session exits.""" denied_paths: list[str] | None = None """Paths explicitly denied.""" readonly_paths: list[str] | None = None """Paths granted read-only access.""" readwrite_paths: list[str] | None = None """Paths granted read/write access.""" @staticmethod def from_dict(obj: Any) -> 'SandboxConfigUserPolicyFilesystem': assert isinstance(obj, dict) clear_policy_on_exit = from_union([from_bool, from_none], obj.get("clearPolicyOnExit")) denied_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("deniedPaths")) readonly_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("readonlyPaths")) readwrite_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("readwritePaths")) return SandboxConfigUserPolicyFilesystem(clear_policy_on_exit, denied_paths, readonly_paths, readwrite_paths) def to_dict(self) -> dict: result: dict = {} if self.clear_policy_on_exit is not None: result["clearPolicyOnExit"] = from_union([from_bool, from_none], self.clear_policy_on_exit) if self.denied_paths is not None: result["deniedPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.denied_paths) if self.readonly_paths is not None: result["readonlyPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.readonly_paths) if self.readwrite_paths is not None: result["readwritePaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.readwrite_paths) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SandboxConfigUserPolicyNetwork: """Network rules to merge into the base policy.""" allowed_hosts: list[str] | None = None """Hosts allowed in addition to the base policy.""" allow_local_network: bool | None = None """Whether traffic to local/loopback addresses is allowed.""" allow_outbound: bool | None = None """Whether outbound network traffic is allowed at all.""" blocked_hosts: list[str] | None = None """Hosts explicitly blocked.""" @staticmethod def from_dict(obj: Any) -> 'SandboxConfigUserPolicyNetwork': assert isinstance(obj, dict) allowed_hosts = from_union([lambda x: from_list(from_str, x), from_none], obj.get("allowedHosts")) allow_local_network = from_union([from_bool, from_none], obj.get("allowLocalNetwork")) allow_outbound = from_union([from_bool, from_none], obj.get("allowOutbound")) blocked_hosts = from_union([lambda x: from_list(from_str, x), from_none], obj.get("blockedHosts")) return SandboxConfigUserPolicyNetwork(allowed_hosts, allow_local_network, allow_outbound, blocked_hosts) def to_dict(self) -> dict: result: dict = {} if self.allowed_hosts is not None: result["allowedHosts"] = from_union([lambda x: from_list(from_str, x), from_none], self.allowed_hosts) if self.allow_local_network is not None: result["allowLocalNetwork"] = from_union([from_bool, from_none], self.allow_local_network) if self.allow_outbound is not None: result["allowOutbound"] = from_union([from_bool, from_none], self.allow_outbound) if self.blocked_hosts is not None: result["blockedHosts"] = from_union([lambda x: from_list(from_str, x), from_none], self.blocked_hosts) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SandboxConfigUserPolicySeatbelt: """macOS seatbelt options to merge into the base policy. macOS seatbelt-specific options. """ keychain_access: bool | None = None """Whether the macOS seatbelt profile may access the keychain.""" @staticmethod def from_dict(obj: Any) -> 'SandboxConfigUserPolicySeatbelt': assert isinstance(obj, dict) keychain_access = from_union([from_bool, from_none], obj.get("keychainAccess")) return SandboxConfigUserPolicySeatbelt(keychain_access) def to_dict(self) -> dict: result: dict = {} if self.keychain_access is not None: result["keychainAccess"] = from_union([from_bool, from_none], self.keychain_access) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleEntry: """Schema for the `ScheduleEntry` type. The removed entry, or omitted if no entry matched. """ id: int """Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). """ next_run_at: datetime """ISO 8601 timestamp when the next tick is scheduled to fire.""" prompt: str """Prompt text that gets enqueued on every tick.""" recurring: bool """Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`).""" at: int | None = None """Absolute fire time (epoch milliseconds) for a one-shot calendar schedule.""" cron: str | None = None """5-field cron expression for a recurring calendar schedule, evaluated in `tz`.""" display_prompt: str | None = None """Display-only label for the prompt as shown in the UI (e.g. `/skill-name` for a skill-invocation schedule). The actual enqueued prompt is `prompt`. """ interval_ms: int | None = None """Interval between scheduled ticks, in milliseconds (relative-interval schedules).""" self_paced: bool | None = None """True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled. """ tz: str | None = None """IANA timezone the `cron` expression is evaluated in.""" @staticmethod def from_dict(obj: Any) -> 'ScheduleEntry': assert isinstance(obj, dict) id = from_int(obj.get("id")) next_run_at = from_datetime(obj.get("nextRunAt")) prompt = from_str(obj.get("prompt")) recurring = from_bool(obj.get("recurring")) at = from_union([from_int, from_none], obj.get("at")) cron = from_union([from_str, from_none], obj.get("cron")) display_prompt = from_union([from_str, from_none], obj.get("displayPrompt")) interval_ms = from_union([from_int, from_none], obj.get("intervalMs")) self_paced = from_union([from_bool, from_none], obj.get("selfPaced")) tz = from_union([from_str, from_none], obj.get("tz")) return ScheduleEntry(id, next_run_at, prompt, recurring, at, cron, display_prompt, interval_ms, self_paced, tz) def to_dict(self) -> dict: result: dict = {} result["id"] = from_int(self.id) result["nextRunAt"] = self.next_run_at.isoformat() result["prompt"] = from_str(self.prompt) result["recurring"] = from_bool(self.recurring) if self.at is not None: result["at"] = from_union([from_int, from_none], self.at) if self.cron is not None: result["cron"] = from_union([from_str, from_none], self.cron) if self.display_prompt is not None: result["displayPrompt"] = from_union([from_str, from_none], self.display_prompt) if self.interval_ms is not None: result["intervalMs"] = from_union([from_int, from_none], self.interval_ms) if self.self_paced is not None: result["selfPaced"] = from_union([from_bool, from_none], self.self_paced) if self.tz is not None: result["tz"] = from_union([from_str, from_none], self.tz) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleStopRequest: """Identifier of the scheduled prompt to remove.""" id: int """Id of the scheduled prompt to remove.""" @staticmethod def from_dict(obj: Any) -> 'ScheduleStopRequest': assert isinstance(obj, dict) id = from_int(obj.get("id")) return ScheduleStopRequest(id) def to_dict(self) -> dict: result: dict = {} result["id"] = from_int(self.id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SecretsAddFilterValuesRequest: """Secret values to add to the redaction filter.""" values: list[str] """Raw secret values to register for redaction""" @staticmethod def from_dict(obj: Any) -> 'SecretsAddFilterValuesRequest': assert isinstance(obj, dict) values = from_list(from_str, obj.get("values")) return SecretsAddFilterValuesRequest(values) def to_dict(self) -> dict: result: dict = {} result["values"] = from_list(from_str, self.values) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SecretsAddFilterValuesResult: """Confirmation that the secret values were registered.""" ok: bool """Whether the values were successfully registered""" @staticmethod def from_dict(obj: Any) -> 'SecretsAddFilterValuesResult': assert isinstance(obj, dict) ok = from_bool(obj.get("ok")) return SecretsAddFilterValuesResult(ok) def to_dict(self) -> dict: result: dict = {} result["ok"] = from_bool(self.ok) return result # Experimental: this type is part of an experimental API and may change or be removed. class SendAgentMode(Enum): """The UI mode the agent was in when this message was sent. Defaults to the session's current mode. """ AUTOPILOT = "autopilot" INTERACTIVE = "interactive" PLAN = "plan" SHELL = "shell" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentsToMessageParams: """Parameters for session.extensions.sendAttachmentsToMessage.""" attachments: list[PushAttachment] """Attachments to push into the next user-message turn. extension_context entries take the slim shape; standard variants take their full AttachmentSchema shape. """ instance_id: str | None = None """Optional canvas instance binding the push for provenance. When supplied, the runtime resolves the canvas, verifies it is owned by the calling extension, and stamps canvasId/instanceId onto each extension_context entry. When omitted, no resolution runs and those fields stay unset on the attachment. """ @staticmethod def from_dict(obj: Any) -> 'SendAttachmentsToMessageParams': assert isinstance(obj, dict) attachments = from_list(_load_PushAttachment, obj.get("attachments")) instance_id = from_union([from_str, from_none], obj.get("instanceId")) return SendAttachmentsToMessageParams(attachments, instance_id) def to_dict(self) -> dict: result: dict = {} result["attachments"] = from_list(lambda x: (x).to_dict(), self.attachments) if self.instance_id is not None: result["instanceId"] = from_union([from_str, from_none], self.instance_id) return result # Experimental: this type is part of an experimental API and may change or be removed. class SendMode(Enum): """How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. """ ENQUEUE = "enqueue" IMMEDIATE = "immediate" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendResult: """Result of sending a user message""" message_id: str """Unique identifier assigned to the message""" @staticmethod def from_dict(obj: Any) -> 'SendResult': assert isinstance(obj, dict) message_id = from_str(obj.get("messageId")) return SendResult(message_id) def to_dict(self) -> dict: result: dict = {} result["messageId"] = from_str(self.message_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ServerSkill: """Schema for the `ServerSkill` type.""" description: str """Description of what the skill does""" enabled: bool """Whether the skill is currently enabled (based on global config)""" name: str """Unique identifier for the skill""" source: SkillSource """Source location type (e.g., project, personal-copilot, plugin, builtin)""" user_invocable: bool """Whether the skill can be invoked by the user as a slash command""" argument_hint: str | None = None """Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field """ path: str | None = None """Absolute path to the skill file""" project_path: str | None = None """The project path this skill belongs to (only for project/inherited skills)""" @staticmethod def from_dict(obj: Any) -> 'ServerSkill': assert isinstance(obj, dict) description = from_str(obj.get("description")) enabled = from_bool(obj.get("enabled")) name = from_str(obj.get("name")) source = SkillSource(obj.get("source")) user_invocable = from_bool(obj.get("userInvocable")) argument_hint = from_union([from_str, from_none], obj.get("argumentHint")) path = from_union([from_str, from_none], obj.get("path")) project_path = from_union([from_str, from_none], obj.get("projectPath")) return ServerSkill(description, enabled, name, source, user_invocable, argument_hint, path, project_path) def to_dict(self) -> dict: result: dict = {} result["description"] = from_str(self.description) result["enabled"] = from_bool(self.enabled) result["name"] = from_str(self.name) result["source"] = to_enum(SkillSource, self.source) result["userInvocable"] = from_bool(self.user_invocable) if self.argument_hint is not None: result["argumentHint"] = from_union([from_str, from_none], self.argument_hint) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.project_path is not None: result["projectPath"] = from_union([from_str, from_none], self.project_path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionActivity: """Current activity flags for the session.""" abortable: bool """Whether an in-flight operation can currently be aborted.""" has_active_work: bool """Whether the session currently has active work, including running turns or tasks.""" @staticmethod def from_dict(obj: Any) -> 'SessionActivity': assert isinstance(obj, dict) abortable = from_bool(obj.get("abortable")) has_active_work = from_bool(obj.get("hasActiveWork")) return SessionActivity(abortable, has_active_work) def to_dict(self) -> dict: result: dict = {} result["abortable"] = from_bool(self.abortable) result["hasActiveWork"] = from_bool(self.has_active_work) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionBulkDeleteResult: """Map of sessionId -> bytes freed by removing the session's workspace directory.""" freed_bytes: dict[str, int] """Map of sessionId -> bytes freed by removing the session's workspace directory. Sessions whose deletion failed are omitted from this map (failures are logged on the server but not surfaced per-id; check the map for absent IDs to detect them). """ @staticmethod def from_dict(obj: Any) -> 'SessionBulkDeleteResult': assert isinstance(obj, dict) freed_bytes = from_dict(from_int, obj.get("freedBytes")) return SessionBulkDeleteResult(freed_bytes) def to_dict(self) -> dict: result: dict = {} result["freedBytes"] = from_dict(from_int, self.freed_bytes) return result # Experimental: this type is part of an experimental API and may change or be removed. class SessionCapability(Enum): """Session capability enabled for this session Session capability id """ ASK_USER = "ask-user" CANVAS_RENDERER = "canvas-renderer" CLI_DOCUMENTATION = "cli-documentation" ELICITATION = "elicitation" INTERACTIVE_MODE = "interactive-mode" MCP_APPS = "mcp-apps" MEMORY = "memory" PLAN_MODE = "plan-mode" SESSION_STORE = "session-store" SYSTEM_NOTIFICATIONS = "system-notifications" TUI_HINTS = "tui-hints" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSAppendFileRequest: """File path, content to append, and optional mode for the client-provided session filesystem. """ content: str """Content to append""" path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" mode: int | None = None """Optional POSIX-style mode for newly created files""" @staticmethod def from_dict(obj: Any) -> 'SessionFSAppendFileRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) mode = from_union([from_int, from_none], obj.get("mode")) return SessionFSAppendFileRequest(content, path, session_id, mode) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) if self.mode is not None: result["mode"] = from_union([from_int, from_none], self.mode) return result # Experimental: this type is part of an experimental API and may change or be removed. class SessionFSErrorCode(Enum): """Error classification""" ENOENT = "ENOENT" UNKNOWN = "UNKNOWN" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSExistsRequest: """Path to test for existence in the client-provided session filesystem.""" path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" @staticmethod def from_dict(obj: Any) -> 'SessionFSExistsRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) return SessionFSExistsRequest(path, session_id) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSExistsResult: """Indicates whether the requested path exists in the client-provided session filesystem.""" exists: bool """Whether the path exists""" @staticmethod def from_dict(obj: Any) -> 'SessionFSExistsResult': assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) return SessionFSExistsResult(exists) def to_dict(self) -> dict: result: dict = {} result["exists"] = from_bool(self.exists) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSMkdirRequest: """Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. """ path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" mode: int | None = None """Optional POSIX-style mode for newly created directories""" recursive: bool | None = None """Create parent directories as needed""" @staticmethod def from_dict(obj: Any) -> 'SessionFSMkdirRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) mode = from_union([from_int, from_none], obj.get("mode")) recursive = from_union([from_bool, from_none], obj.get("recursive")) return SessionFSMkdirRequest(path, session_id, mode, recursive) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) if self.mode is not None: result["mode"] = from_union([from_int, from_none], self.mode) if self.recursive is not None: result["recursive"] = from_union([from_bool, from_none], self.recursive) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReadFileRequest: """Path of the file to read from the client-provided session filesystem.""" path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" @staticmethod def from_dict(obj: Any) -> 'SessionFSReadFileRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) return SessionFSReadFileRequest(path, session_id) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirRequest: """Directory path whose entries should be listed from the client-provided session filesystem.""" path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" @staticmethod def from_dict(obj: Any) -> 'SessionFSReaddirRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) return SessionFSReaddirRequest(path, session_id) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirWithTypesRequest: """Directory path whose entries (with type information) should be listed from the client-provided session filesystem. """ path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" @staticmethod def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) return SessionFSReaddirWithTypesRequest(path, session_id) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSRenameRequest: """Source and destination paths for renaming or moving an entry in the client-provided session filesystem. """ dest: str """Destination path using SessionFs conventions""" session_id: str """Target session identifier""" src: str """Source path using SessionFs conventions""" @staticmethod def from_dict(obj: Any) -> 'SessionFSRenameRequest': assert isinstance(obj, dict) dest = from_str(obj.get("dest")) session_id = from_str(obj.get("sessionId")) src = from_str(obj.get("src")) return SessionFSRenameRequest(dest, session_id, src) def to_dict(self) -> dict: result: dict = {} result["dest"] = from_str(self.dest) result["sessionId"] = from_str(self.session_id) result["src"] = from_str(self.src) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSRmRequest: """Path to remove from the client-provided session filesystem, with options for recursive removal and force. """ path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" force: bool | None = None """Ignore errors if the path does not exist""" recursive: bool | None = None """Remove directories and their contents recursively""" @staticmethod def from_dict(obj: Any) -> 'SessionFSRmRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) force = from_union([from_bool, from_none], obj.get("force")) recursive = from_union([from_bool, from_none], obj.get("recursive")) return SessionFSRmRequest(path, session_id, force, recursive) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) if self.force is not None: result["force"] = from_union([from_bool, from_none], self.force) if self.recursive is not None: result["recursive"] = from_union([from_bool, from_none], self.recursive) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSetProviderCapabilities: """Optional capabilities declared by the provider""" sqlite: bool | None = None """Whether the provider supports SQLite query/exists operations""" @staticmethod def from_dict(obj: Any) -> 'SessionFSSetProviderCapabilities': assert isinstance(obj, dict) sqlite = from_union([from_bool, from_none], obj.get("sqlite")) return SessionFSSetProviderCapabilities(sqlite) def to_dict(self) -> dict: result: dict = {} if self.sqlite is not None: result["sqlite"] = from_union([from_bool, from_none], self.sqlite) return result # Experimental: this type is part of an experimental API and may change or be removed. class SessionFSSetProviderConventions(Enum): """Path conventions used by this filesystem""" POSIX = "posix" WINDOWS = "windows" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSetProviderResult: """Indicates whether the calling client was registered as the session filesystem provider.""" success: bool """Whether the provider was set successfully""" @staticmethod def from_dict(obj: Any) -> 'SessionFSSetProviderResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return SessionFSSetProviderResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSqliteExistsRequest: """Identifies the target session.""" session_id: str """Target session identifier""" @staticmethod def from_dict(obj: Any) -> 'SessionFSSqliteExistsRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionFSSqliteExistsRequest(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSqliteExistsResult: """Indicates whether the per-session SQLite database already exists.""" exists: bool """Whether the session database already exists""" @staticmethod def from_dict(obj: Any) -> 'SessionFSSqliteExistsResult': assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) return SessionFSSqliteExistsResult(exists) def to_dict(self) -> dict: result: dict = {} result["exists"] = from_bool(self.exists) return result # Experimental: this type is part of an experimental API and may change or be removed. class SessionFSSqliteQueryType(Enum): """How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) """ EXEC = "exec" QUERY = "query" RUN = "run" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSStatRequest: """Path whose metadata should be returned from the client-provided session filesystem.""" path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" @staticmethod def from_dict(obj: Any) -> 'SessionFSStatRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) return SessionFSStatRequest(path, session_id) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSWriteFileRequest: """File path, content to write, and optional mode for the client-provided session filesystem.""" content: str """Content to write""" path: str """Path using SessionFs conventions""" session_id: str """Target session identifier""" mode: int | None = None """Optional POSIX-style mode for newly created files""" @staticmethod def from_dict(obj: Any) -> 'SessionFSWriteFileRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) mode = from_union([from_int, from_none], obj.get("mode")) return SessionFSWriteFileRequest(content, path, session_id, mode) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) result["path"] = from_str(self.path) result["sessionId"] = from_str(self.session_id) if self.mode is not None: result["mode"] = from_union([from_int, from_none], self.mode) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionList: """Sessions matching the filter, ordered most-recently-modified first.""" sessions: list[SessionListEntry] """Sessions ordered most-recently-modified first. Discriminated by `isRemote`.""" @staticmethod def from_dict(obj: Any) -> 'SessionList': assert isinstance(obj, dict) sessions = from_list(_load_SessionListEntry, obj.get("sessions")) return SessionList(sessions) def to_dict(self) -> dict: result: dict = {} result["sessions"] = from_list(lambda x: (x).to_dict(), self.sessions) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionListFilter: """Optional filter applied to the returned sessions""" branch: str | None = None """Match sessions whose context.branch equals this value""" cwd: str | None = None """Match sessions whose context.cwd equals this value""" git_root: str | None = None """Match sessions whose context.gitRoot equals this value""" repository: str | None = None """Match sessions whose context.repository equals this value""" @staticmethod def from_dict(obj: Any) -> 'SessionListFilter': assert isinstance(obj, dict) branch = from_union([from_str, from_none], obj.get("branch")) cwd = from_union([from_str, from_none], obj.get("cwd")) git_root = from_union([from_str, from_none], obj.get("gitRoot")) repository = from_union([from_str, from_none], obj.get("repository")) return SessionListFilter(branch, cwd, git_root, repository) def to_dict(self) -> dict: result: dict = {} if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.git_root is not None: result["gitRoot"] = from_union([from_str, from_none], self.git_root) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionLoadDeferredRepoHooksResult: """Queued repo-level startup prompts and the total hook command count after loading.""" hook_count: int """Total hook command count (user + plugin + repo) loaded for the session by this call. Captured atomically with startupPrompts so callers don't need to read a separate counter. """ startup_prompts: list[str] """Repo-level startup prompts queued from repo hook configs. Empty on resume, when no repo configs were pending, or when disableAllHooks is set. """ @staticmethod def from_dict(obj: Any) -> 'SessionLoadDeferredRepoHooksResult': assert isinstance(obj, dict) hook_count = from_int(obj.get("hookCount")) startup_prompts = from_list(from_str, obj.get("startupPrompts")) return SessionLoadDeferredRepoHooksResult(hook_count, startup_prompts) def to_dict(self) -> dict: result: dict = {} result["hookCount"] = from_int(self.hook_count) result["startupPrompts"] = from_list(from_str, self.startup_prompts) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionModelList: """The list of models available to this session.""" list: list[Any] """Available models, ordered with the most preferred default first. Includes both Copilot (CAPI) models and any registry BYOK models; a BYOK model appears under its provider-qualified selection id (`provider/id`). """ quota_snapshots: dict[str, Any] | None = None """Per-quota snapshots returned alongside the model list, keyed by quota type.""" @staticmethod def from_dict(obj: Any) -> 'SessionModelList': assert isinstance(obj, dict) list = from_list(lambda x: x, obj.get("list")) quota_snapshots = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("quotaSnapshots")) return SessionModelList(list, quota_snapshots) def to_dict(self) -> dict: result: dict = {} result["list"] = from_list(lambda x: x, self.list) if self.quota_snapshots is not None: result["quotaSnapshots"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.quota_snapshots) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource: """Schema for the `SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource` type.""" name: str type: str @staticmethod def from_dict(obj: Any) -> 'SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource': assert isinstance(obj, dict) name = from_str(obj.get("name")) type = from_str(obj.get("type")) return SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource(name, type) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["type"] = from_str(self.type) return result class SessionOpenParamsKind(Enum): ATTACH = "attach" CLOUD = "cloud" CREATE = "create" HANDOFF = "handoff" REMOTE = "remote" RESUME = "resume" RESUME_LAST = "resumeLast" # Experimental: this type is part of an experimental API and may change or be removed. class SessionsOpenProgressStatus(Enum): """Step status.""" COMPLETE = "complete" IN_PROGRESS = "in-progress" # Experimental: this type is part of an experimental API and may change or be removed. class SessionsOpenProgressStep(Enum): """Handoff step.""" CHECKOUT_BRANCH = "checkout-branch" CHECK_CHANGES = "check-changes" CREATE_SESSION = "create-session" LOAD_SESSION = "load-session" SAVE_SESSION = "save-session" VALIDATE_REPO = "validate-repo" # Experimental: this type is part of an experimental API and may change or be removed. class SessionsOpenStatus(Enum): """Outcome of the open request.""" CONNECTED = "connected" CREATED = "created" HANDED_OFF = "handed_off" NOT_FOUND = "not_found" RESUMED = "resumed" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionPruneResult: """Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. """ candidates: list[str] """Session IDs that would be deleted in dry-run mode (always empty otherwise)""" deleted: list[str] """Session IDs that were deleted (always empty in dry-run mode)""" dry_run: bool """True when no deletions were actually performed""" freed_bytes: int """Total bytes freed (actual when not dry-run, projected when dry-run)""" skipped: list[str] """Session IDs that were skipped (e.g., named sessions)""" @staticmethod def from_dict(obj: Any) -> 'SessionPruneResult': assert isinstance(obj, dict) candidates = from_list(from_str, obj.get("candidates")) deleted = from_list(from_str, obj.get("deleted")) dry_run = from_bool(obj.get("dryRun")) freed_bytes = from_int(obj.get("freedBytes")) skipped = from_list(from_str, obj.get("skipped")) return SessionPruneResult(candidates, deleted, dry_run, freed_bytes, skipped) def to_dict(self) -> dict: result: dict = {} result["candidates"] = from_list(from_str, self.candidates) result["deleted"] = from_list(from_str, self.deleted) result["dryRun"] = from_bool(self.dry_run) result["freedBytes"] = from_int(self.freed_bytes) result["skipped"] = from_list(from_str, self.skipped) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSetCredentialsParams: """New auth credentials to install on the session. Omit to leave credentials unchanged.""" credentials: AuthInfo | None = None """The new auth credentials to install on the session. When omitted or `undefined`, the call is a no-op and the session's existing credentials are preserved. The runtime installs the supplied value immediately for outbound model/API requests. When the credential carries a raw token (`token`, `env`, or `gh-cli`) but no `copilotUser`, the runtime additionally re-resolves `copilotUser` server-side (best-effort, asynchronously, after the synchronous install) so plan/quota/billing metadata regains fidelity; on resolution failure the verbatim credential remains installed. It does NOT otherwise validate the credential. Several variants carry secret material; treat this method's params as containing secrets at rest and in transit. """ @staticmethod def from_dict(obj: Any) -> 'SessionSetCredentialsParams': assert isinstance(obj, dict) credentials = from_union([_load_AuthInfo, from_none], obj.get("credentials")) return SessionSetCredentialsParams(credentials) def to_dict(self) -> dict: result: dict = {} if self.credentials is not None: result["credentials"] = from_union([lambda x: (x).to_dict(), from_none], self.credentials) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSetCredentialsResult: """Indicates whether the credential update succeeded.""" success: bool """Whether the operation succeeded""" copilot_user_resolved: bool | None = None """Whether the session ended up with a populated `copilotUser` for the installed credentials. `true` when the supplied credential already carried `copilotUser` or it was successfully re-resolved server-side. `false` when the credential is installed without `copilotUser` — either re-resolution failed, or the variant cannot be re-resolved from the credential alone (only the raw-token variants `token`, `env`, and `gh-cli` can). In both `false` cases the token swap still applied, but plan/quota/billing metadata is degraded. Present whenever a credential was supplied; omitted only when no credential was supplied (no-op call). """ @staticmethod def from_dict(obj: Any) -> 'SessionSetCredentialsResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) copilot_user_resolved = from_union([from_bool, from_none], obj.get("copilotUserResolved")) return SessionSetCredentialsResult(success, copilot_user_resolved) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) if self.copilot_user_resolved is not None: result["copilotUserResolved"] = from_union([from_bool, from_none], self.copilot_user_resolved) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSizes: """Map of sessionId -> on-disk size in bytes for each session's workspace directory.""" sizes: dict[str, int] """Map of sessionId -> on-disk size in bytes for the session's workspace directory""" @staticmethod def from_dict(obj: Any) -> 'SessionSizes': assert isinstance(obj, dict) sizes = from_dict(from_int, obj.get("sizes")) return SessionSizes(sizes) def to_dict(self) -> dict: result: dict = {} result["sizes"] = from_dict(from_int, self.sizes) return result # Experimental: this type is part of an experimental API and may change or be removed. class SessionSource(Enum): """Which session sources to include. Defaults to `local` for backward compatibility.""" ALL = "all" LOCAL = "local" REMOTE = "remote" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionTelemetryEngagement: """Telemetry engagement ID for the session, when available.""" engagement_id: str | None = None """Current telemetry engagement ID, when available.""" @staticmethod def from_dict(obj: Any) -> 'SessionTelemetryEngagement': assert isinstance(obj, dict) engagement_id = from_union([from_str, from_none], obj.get("engagementId")) return SessionTelemetryEngagement(engagement_id) def to_dict(self) -> dict: result: dict = {} if self.engagement_id is not None: result["engagementId"] = from_union([from_str, from_none], self.engagement_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionUpdateOptionsResult: """Indicates whether the session options patch was applied successfully.""" success: bool """Whether the operation succeeded""" @staticmethod def from_dict(obj: Any) -> 'SessionUpdateOptionsResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return SessionUpdateOptionsResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. class SessionVisibilityStatus(Enum): """Sharing status for a synced session. "repo" makes the session visible to anyone with read access to the repository; "unshared" restricts it to the creator and collaborators. Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). Sharing status to apply. "repo" makes the session visible to repository readers; "unshared" restricts it to the creator and collaborators. Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). """ REPO = "repo" UNSHARED = "unshared" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsBulkDeleteRequest: """Session IDs to close, deactivate, and delete from disk.""" session_ids: list[str] """Session IDs to close, deactivate, and delete from disk""" @staticmethod def from_dict(obj: Any) -> 'SessionsBulkDeleteRequest': assert isinstance(obj, dict) session_ids = from_list(from_str, obj.get("sessionIds")) return SessionsBulkDeleteRequest(session_ids) def to_dict(self) -> dict: result: dict = {} result["sessionIds"] = from_list(from_str, self.session_ids) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCheckInUseRequest: """Session IDs to test for live in-use locks.""" session_ids: list[str] """Session IDs to test for live in-use locks""" @staticmethod def from_dict(obj: Any) -> 'SessionsCheckInUseRequest': assert isinstance(obj, dict) session_ids = from_list(from_str, obj.get("sessionIds")) return SessionsCheckInUseRequest(session_ids) def to_dict(self) -> dict: result: dict = {} result["sessionIds"] = from_list(from_str, self.session_ids) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCheckInUseResult: """Session IDs from the input set that are currently in use by another process.""" in_use: list[str] """Session IDs from the input set that are currently held by another running process via an alive lock file """ @staticmethod def from_dict(obj: Any) -> 'SessionsCheckInUseResult': assert isinstance(obj, dict) in_use = from_list(from_str, obj.get("inUse")) return SessionsCheckInUseResult(in_use) def to_dict(self) -> dict: result: dict = {} result["inUse"] = from_list(from_str, self.in_use) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCloseRequest: """Session ID to close.""" session_id: str """Session ID to close""" @staticmethod def from_dict(obj: Any) -> 'SessionsCloseRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsCloseRequest(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCloseResult: """Closes a session: emits shutdown, flushes pending events to disk, releases the in-use lock, disposes the active session. Idempotent: succeeds even if the session is not currently active. """ @staticmethod def from_dict(obj: Any) -> 'SessionsCloseResult': assert isinstance(obj, dict) return SessionsCloseResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByPrefixRequest: """UUID prefix to resolve to a unique session ID.""" prefix: str """UUID prefix (>=7 hex chars, <36 chars). Returns the unique session ID, or undefined when there is no match or the prefix matches multiple sessions. """ @staticmethod def from_dict(obj: Any) -> 'SessionsFindByPrefixRequest': assert isinstance(obj, dict) prefix = from_str(obj.get("prefix")) return SessionsFindByPrefixRequest(prefix) def to_dict(self) -> dict: result: dict = {} result["prefix"] = from_str(self.prefix) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByPrefixResult: """Session ID matching the prefix, omitted when no unique match exists.""" session_id: str | None = None """Omitted when no unique session matches the prefix (no match or ambiguous)""" @staticmethod def from_dict(obj: Any) -> 'SessionsFindByPrefixResult': assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsFindByPrefixResult(session_id) def to_dict(self) -> dict: result: dict = {} if self.session_id is not None: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByTaskIDRequest: """GitHub task ID to look up.""" task_id: str """GitHub task ID to look up""" @staticmethod def from_dict(obj: Any) -> 'SessionsFindByTaskIDRequest': assert isinstance(obj, dict) task_id = from_str(obj.get("taskId")) return SessionsFindByTaskIDRequest(task_id) def to_dict(self) -> dict: result: dict = {} result["taskId"] = from_str(self.task_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByTaskIDResult: """ID of the local session bound to the given GitHub task, or omitted when none.""" session_id: str | None = None """Omitted when no local session is bound to that GitHub task""" @staticmethod def from_dict(obj: Any) -> 'SessionsFindByTaskIDResult': assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsFindByTaskIDResult(session_id) def to_dict(self) -> dict: result: dict = {} if self.session_id is not None: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsForkRequest: """Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. """ session_id: str """Source session ID to fork from""" name: str | None = None """Optional friendly name to assign to the forked session.""" to_event_id: str | None = None """Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. """ @staticmethod def from_dict(obj: Any) -> 'SessionsForkRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) name = from_union([from_str, from_none], obj.get("name")) to_event_id = from_union([from_str, from_none], obj.get("toEventId")) return SessionsForkRequest(session_id, name, to_event_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.to_event_id is not None: result["toEventId"] = from_union([from_str, from_none], self.to_event_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsForkResult: """Identifier and optional friendly name assigned to the newly forked session.""" session_id: str """The new forked session's ID""" name: str | None = None """Friendly name assigned to the forked session, if any.""" @staticmethod def from_dict(obj: Any) -> 'SessionsForkResult': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) name = from_union([from_str, from_none], obj.get("name")) return SessionsForkResult(session_id, name) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetBoardEntryCountRequest: """Session ID whose board entry count should be returned.""" session_id: str """Session ID whose board entry count should be returned.""" @staticmethod def from_dict(obj: Any) -> 'SessionsGetBoardEntryCountRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsGetBoardEntryCountRequest(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetBoardEntryCountResult: """Dynamic-context board entry count, when available.""" count: int | None = None """Board entry count, when available.""" @staticmethod def from_dict(obj: Any) -> 'SessionsGetBoardEntryCountResult': assert isinstance(obj, dict) count = from_union([from_int, from_none], obj.get("count")) return SessionsGetBoardEntryCountResult(count) def to_dict(self) -> dict: result: dict = {} if self.count is not None: result["count"] = from_union([from_int, from_none], self.count) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetEventFilePathRequest: """Session ID whose event-log file path to compute.""" session_id: str """Session ID whose event-log file path to compute""" @staticmethod def from_dict(obj: Any) -> 'SessionsGetEventFilePathRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsGetEventFilePathRequest(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetEventFilePathResult: """Absolute path to the session's events.jsonl file on disk.""" file_path: str """Absolute path to the session's events.jsonl file""" @staticmethod def from_dict(obj: Any) -> 'SessionsGetEventFilePathResult': assert isinstance(obj, dict) file_path = from_str(obj.get("filePath")) return SessionsGetEventFilePathResult(file_path) def to_dict(self) -> dict: result: dict = {} result["filePath"] = from_str(self.file_path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetLastForContextResult: """Most-relevant session ID for the supplied context, or omitted when no sessions exist.""" session_id: str | None = None """Most-relevant session ID for the supplied context, or omitted when no sessions exist""" @staticmethod def from_dict(obj: Any) -> 'SessionsGetLastForContextResult': assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsGetLastForContextResult(session_id) def to_dict(self) -> dict: result: dict = {} if self.session_id is not None: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetPersistedRemoteSteerableRequest: """Session ID to look up the persisted remote-steerable flag for.""" session_id: str """Session ID to look up the persisted remote-steerable flag for""" @staticmethod def from_dict(obj: Any) -> 'SessionsGetPersistedRemoteSteerableRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsGetPersistedRemoteSteerableRequest(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetPersistedRemoteSteerableResult: """The session's persisted remote-steerable flag, or omitted when no value has been persisted. """ remote_steerable: bool | None = None """The session's persisted remote-steerable flag if recorded; omitted when no value has been persisted """ @staticmethod def from_dict(obj: Any) -> 'SessionsGetPersistedRemoteSteerableResult': assert isinstance(obj, dict) remote_steerable = from_union([from_bool, from_none], obj.get("remoteSteerable")) return SessionsGetPersistedRemoteSteerableResult(remote_steerable) def to_dict(self) -> dict: result: dict = {} if self.remote_steerable is not None: result["remoteSteerable"] = from_union([from_bool, from_none], self.remote_steerable) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsLoadDeferredRepoHooksRequest: """Active session ID whose deferred repo-level hooks should be loaded.""" session_id: str """Active session ID whose deferred repo-level hooks should be loaded""" @staticmethod def from_dict(obj: Any) -> 'SessionsLoadDeferredRepoHooksRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsLoadDeferredRepoHooksRequest(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result class SessionsOpenAttachKind(Enum): ATTACH = "attach" class SessionsOpenCloudKind(Enum): CLOUD = "cloud" class SessionsOpenCreateKind(Enum): CREATE = "create" class SessionsOpenHandoffKind(Enum): HANDOFF = "handoff" class SessionsOpenRemoteKind(Enum): REMOTE = "remote" class SessionsOpenResumeKind(Enum): RESUME = "resume" class SessionsOpenResumeLastKind(Enum): RESUME_LAST = "resumeLast" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsPollSpawnedSessionsRequest: cursor: str | None = None """Opaque cursor returned by a previous poll. Omit on the first call to receive any spawn events buffered since the runtime started. """ wait_ms: int | None = None """Milliseconds to wait for new spawn events when the cursor is at the tail. 0 (default) returns immediately even if no events are buffered. Capped at 60000ms. """ @staticmethod def from_dict(obj: Any) -> 'SessionsPollSpawnedSessionsRequest': assert isinstance(obj, dict) cursor = from_union([from_str, from_none], obj.get("cursor")) wait_ms = from_union([from_int, from_none], obj.get("waitMs")) return SessionsPollSpawnedSessionsRequest(cursor, wait_ms) def to_dict(self) -> dict: result: dict = {} if self.cursor is not None: result["cursor"] = from_union([from_str, from_none], self.cursor) if self.wait_ms is not None: result["waitMs"] = from_union([from_int, from_none], self.wait_ms) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsPruneOldRequest: """Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). """ older_than_days: int """Delete sessions whose modifiedTime is at least this many days old""" dry_run: bool | None = None """When true, only report what would be deleted without performing any deletion""" exclude_session_ids: list[str] | None = None """Session IDs that should never be considered for pruning""" include_named: bool | None = None """When true, named sessions (set via /rename) are also eligible for pruning""" @staticmethod def from_dict(obj: Any) -> 'SessionsPruneOldRequest': assert isinstance(obj, dict) older_than_days = from_int(obj.get("olderThanDays")) dry_run = from_union([from_bool, from_none], obj.get("dryRun")) exclude_session_ids = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludeSessionIds")) include_named = from_union([from_bool, from_none], obj.get("includeNamed")) return SessionsPruneOldRequest(older_than_days, dry_run, exclude_session_ids, include_named) def to_dict(self) -> dict: result: dict = {} result["olderThanDays"] = from_int(self.older_than_days) if self.dry_run is not None: result["dryRun"] = from_union([from_bool, from_none], self.dry_run) if self.exclude_session_ids is not None: result["excludeSessionIds"] = from_union([lambda x: from_list(from_str, x), from_none], self.exclude_session_ids) if self.include_named is not None: result["includeNamed"] = from_union([from_bool, from_none], self.include_named) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReleaseLockRequest: """Session ID whose in-use lock should be released.""" session_id: str """Session ID whose in-use lock should be released""" @staticmethod def from_dict(obj: Any) -> 'SessionsReleaseLockRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsReleaseLockRequest(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReleaseLockResult: """Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session. """ @staticmethod def from_dict(obj: Any) -> 'SessionsReleaseLockResult': assert isinstance(obj, dict) return SessionsReleaseLockResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReloadPluginHooksRequest: """Active session ID and an optional flag for deferring repo-level hooks until folder trust.""" session_id: str """Active session ID to reload hooks for""" defer_repo_hooks: bool | None = None """When true, skip repo-level hooks. Use before folder trust is confirmed; loadDeferredRepoHooks loads them post-trust. """ @staticmethod def from_dict(obj: Any) -> 'SessionsReloadPluginHooksRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) defer_repo_hooks = from_union([from_bool, from_none], obj.get("deferRepoHooks")) return SessionsReloadPluginHooksRequest(session_id, defer_repo_hooks) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) if self.defer_repo_hooks is not None: result["deferRepoHooks"] = from_union([from_bool, from_none], self.defer_repo_hooks) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReloadPluginHooksResult: """Reload all hooks (user, plugin, optionally repo) and apply them to the active session. Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId. """ @staticmethod def from_dict(obj: Any) -> 'SessionsReloadPluginHooksResult': assert isinstance(obj, dict) return SessionsReloadPluginHooksResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSaveRequest: """Session ID whose pending events should be flushed to disk.""" session_id: str """Session ID whose pending events should be flushed to disk""" @staticmethod def from_dict(obj: Any) -> 'SessionsSaveRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsSaveRequest(session_id) def to_dict(self) -> dict: result: dict = {} result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSaveResult: """Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). """ @staticmethod def from_dict(obj: Any) -> 'SessionsSaveResult': assert isinstance(obj, dict) return SessionsSaveResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSetAdditionalPluginsResult: """Replace the manager-wide additional plugins. New session creations and subsequent hook reloads see the new set; already-running sessions keep their existing hook installation until the next reload. """ @staticmethod def from_dict(obj: Any) -> 'SessionsSetAdditionalPluginsResult': assert isinstance(obj, dict) return SessionsSetAdditionalPluginsResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSetRemoteControlSteeringRequest: """Patch for the singleton's steering state.""" enabled: bool """Target steering state. Today only `true` is actionable on the underlying exporter; `false` is reserved for future use. """ @staticmethod def from_dict(obj: Any) -> 'SessionsSetRemoteControlSteeringRequest': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) return SessionsSetRemoteControlSteeringRequest(enabled) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsStopRemoteControlRequest: expected_session_id: str | None = None """When provided, the stop is rejected unless the singleton currently points at this session id (compare-and-swap semantics). """ force: bool | None = None """When true, the singleton is unconditionally torn down regardless of `expectedSessionId`. Use during shutdown or explicit `/remote off`. """ @staticmethod def from_dict(obj: Any) -> 'SessionsStopRemoteControlRequest': assert isinstance(obj, dict) expected_session_id = from_union([from_str, from_none], obj.get("expectedSessionId")) force = from_union([from_bool, from_none], obj.get("force")) return SessionsStopRemoteControlRequest(expected_session_id, force) def to_dict(self) -> dict: result: dict = {} if self.expected_session_id is not None: result["expectedSessionId"] = from_union([from_str, from_none], self.expected_session_id) if self.force is not None: result["force"] = from_union([from_bool, from_none], self.force) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsTransferRemoteControlRequest: """Parameters for atomically rebinding the remote-control singleton.""" to_session_id: str """Local session id to point remote control at.""" expected_from_session_id: str | None = None """When provided, the transfer is rejected unless the singleton currently points at this session id (compare-and-swap semantics to avoid clobbering newer state). """ @staticmethod def from_dict(obj: Any) -> 'SessionsTransferRemoteControlRequest': assert isinstance(obj, dict) to_session_id = from_str(obj.get("toSessionId")) expected_from_session_id = from_union([from_str, from_none], obj.get("expectedFromSessionId")) return SessionsTransferRemoteControlRequest(to_session_id, expected_from_session_id) def to_dict(self) -> dict: result: dict = {} result["toSessionId"] = from_str(self.to_session_id) if self.expected_from_session_id is not None: result["expectedFromSessionId"] = from_union([from_str, from_none], self.expected_from_session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellCancelUserRequestedRequest: """User-requested shell execution cancellation handle.""" request_id: str """Request ID previously passed to executeUserRequested""" @staticmethod def from_dict(obj: Any) -> 'ShellCancelUserRequestedRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) return ShellCancelUserRequestedRequest(request_id) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellExecRequest: """Shell command to run, with optional working directory and timeout in milliseconds.""" command: str """Shell command to execute""" cwd: str | None = None """Working directory (defaults to session working directory)""" timeout: int | None = None """Timeout in milliseconds (default: 30000)""" @staticmethod def from_dict(obj: Any) -> 'ShellExecRequest': assert isinstance(obj, dict) command = from_str(obj.get("command")) cwd = from_union([from_str, from_none], obj.get("cwd")) timeout = from_union([from_int, from_none], obj.get("timeout")) return ShellExecRequest(command, cwd, timeout) def to_dict(self) -> dict: result: dict = {} result["command"] = from_str(self.command) if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellExecResult: """Identifier of the spawned process, used to correlate streamed output and exit notifications. """ process_id: str """Unique identifier for tracking streamed output""" @staticmethod def from_dict(obj: Any) -> 'ShellExecResult': assert isinstance(obj, dict) process_id = from_str(obj.get("processId")) return ShellExecResult(process_id) def to_dict(self) -> dict: result: dict = {} result["processId"] = from_str(self.process_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellExecuteUserRequestedRequest: """User-requested shell command and cancellation handle.""" command: str """Shell command to execute""" request_id: str """Caller-provided cancellation handle for this execution""" @staticmethod def from_dict(obj: Any) -> 'ShellExecuteUserRequestedRequest': assert isinstance(obj, dict) command = from_str(obj.get("command")) request_id = from_str(obj.get("requestId")) return ShellExecuteUserRequestedRequest(command, request_id) def to_dict(self) -> dict: result: dict = {} result["command"] = from_str(self.command) result["requestId"] = from_str(self.request_id) return result # Experimental: this type is part of an experimental API and may change or be removed. class ShellKillSignal(Enum): """Signal to send (default: SIGTERM)""" SIGINT = "SIGINT" SIGKILL = "SIGKILL" SIGTERM = "SIGTERM" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellKillResult: """Indicates whether the signal was delivered; false if the process was unknown or already exited. """ killed: bool """Whether the signal was sent successfully""" @staticmethod def from_dict(obj: Any) -> 'ShellKillResult': assert isinstance(obj, dict) killed = from_bool(obj.get("killed")) return ShellKillResult(killed) def to_dict(self) -> dict: result: dict = {} result["killed"] = from_bool(self.killed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShutdownRequest: """Parameters for shutting down the session""" reason: str | None = None """Optional human-readable reason. Typically the message of the error that triggered shutdown when type is 'error'. """ type: ShutdownType | None = None """Why the session is being shut down. Defaults to "routine" when omitted.""" @staticmethod def from_dict(obj: Any) -> 'ShutdownRequest': assert isinstance(obj, dict) reason = from_union([from_str, from_none], obj.get("reason")) type = from_union([ShutdownType, from_none], obj.get("type")) return ShutdownRequest(reason, type) def to_dict(self) -> dict: result: dict = {} if self.reason is not None: result["reason"] = from_union([from_str, from_none], self.reason) if self.type is not None: result["type"] = from_union([lambda x: to_enum(ShutdownType, x), from_none], self.type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Skill: """Schema for the `Skill` type.""" description: str """Description of what the skill does""" enabled: bool """Whether the skill is currently enabled""" name: str """Unique identifier for the skill""" source: SkillSource """Source location type (e.g., project, personal-copilot, plugin, builtin)""" user_invocable: bool """Whether the skill can be invoked by the user as a slash command""" argument_hint: str | None = None """Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field """ path: str | None = None """Absolute path to the skill file""" plugin_name: str | None = None """Name of the plugin that provides the skill, when source is 'plugin'""" @staticmethod def from_dict(obj: Any) -> 'Skill': assert isinstance(obj, dict) description = from_str(obj.get("description")) enabled = from_bool(obj.get("enabled")) name = from_str(obj.get("name")) source = SkillSource(obj.get("source")) user_invocable = from_bool(obj.get("userInvocable")) argument_hint = from_union([from_str, from_none], obj.get("argumentHint")) path = from_union([from_str, from_none], obj.get("path")) plugin_name = from_union([from_str, from_none], obj.get("pluginName")) return Skill(description, enabled, name, source, user_invocable, argument_hint, path, plugin_name) def to_dict(self) -> dict: result: dict = {} result["description"] = from_str(self.description) result["enabled"] = from_bool(self.enabled) result["name"] = from_str(self.name) result["source"] = to_enum(SkillSource, self.source) result["userInvocable"] = from_bool(self.user_invocable) if self.argument_hint is not None: result["argumentHint"] = from_union([from_str, from_none], self.argument_hint) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.plugin_name is not None: result["pluginName"] = from_union([from_str, from_none], self.plugin_name) return result # Experimental: this type is part of an experimental API and may change or be removed. class SkillDiscoveryScope(Enum): """Which tier this directory belongs to""" CUSTOM = "custom" PERSONAL_AGENTS = "personal-agents" PERSONAL_COPILOT = "personal-copilot" PROJECT = "project" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsDisableRequest: """Name of the skill to disable for the session.""" name: str """Name of the skill to disable""" @staticmethod def from_dict(obj: Any) -> 'SkillsDisableRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return SkillsDisableRequest(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsDiscoverRequest: """Optional project paths and additional skill directories to include in discovery.""" exclude_host_skills: bool | None = None """When true, omit skills from the host's global sources (personal, custom, plugin, and built-in), returning only project-scoped skills. For multitenant deployments. """ project_paths: list[str] | None = None """Optional list of project directory paths to scan for project-scoped skills""" skill_directories: list[str] | None = None """Optional list of additional skill directory paths to include""" @staticmethod def from_dict(obj: Any) -> 'SkillsDiscoverRequest': assert isinstance(obj, dict) exclude_host_skills = from_union([from_bool, from_none], obj.get("excludeHostSkills")) project_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("projectPaths")) skill_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories")) return SkillsDiscoverRequest(exclude_host_skills, project_paths, skill_directories) def to_dict(self) -> dict: result: dict = {} if self.exclude_host_skills is not None: result["excludeHostSkills"] = from_union([from_bool, from_none], self.exclude_host_skills) if self.project_paths is not None: result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) if self.skill_directories is not None: result["skillDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.skill_directories) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsEnableRequest: """Name of the skill to enable for the session.""" name: str """Name of the skill to enable""" @staticmethod def from_dict(obj: Any) -> 'SkillsEnableRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return SkillsEnableRequest(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsGetDiscoveryPathsRequest: """Optional project paths to enumerate.""" exclude_host_skills: bool | None = None """When true, omit the host's personal and custom skill directories, leaving only project directories. For multitenant deployments. """ project_paths: list[str] | None = None """Optional list of project directory paths. When omitted or empty, only personal and custom directories are returned. """ @staticmethod def from_dict(obj: Any) -> 'SkillsGetDiscoveryPathsRequest': assert isinstance(obj, dict) exclude_host_skills = from_union([from_bool, from_none], obj.get("excludeHostSkills")) project_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("projectPaths")) return SkillsGetDiscoveryPathsRequest(exclude_host_skills, project_paths) def to_dict(self) -> dict: result: dict = {} if self.exclude_host_skills is not None: result["excludeHostSkills"] = from_union([from_bool, from_none], self.exclude_host_skills) if self.project_paths is not None: result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsInvokedSkill: """Schema for the `SkillsInvokedSkill` type.""" content: str """Full content of the skill file""" invoked_at_turn: int """Turn number when the skill was invoked""" name: str """Unique identifier for the skill""" path: str """Path to the SKILL.md file""" allowed_tools: list[str] | None = None """Tools that should be auto-approved when this skill is active, captured at invocation time""" @staticmethod def from_dict(obj: Any) -> 'SkillsInvokedSkill': assert isinstance(obj, dict) content = from_str(obj.get("content")) invoked_at_turn = from_int(obj.get("invokedAtTurn")) name = from_str(obj.get("name")) path = from_str(obj.get("path")) allowed_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("allowedTools")) return SkillsInvokedSkill(content, invoked_at_turn, name, path, allowed_tools) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) result["invokedAtTurn"] = from_int(self.invoked_at_turn) result["name"] = from_str(self.name) result["path"] = from_str(self.path) if self.allowed_tools is not None: result["allowedTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.allowed_tools) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsLoadDiagnostics: """Diagnostics from reloading skill definitions, with warnings and errors as separate lists.""" errors: list[str] """Errors emitted while loading skills (e.g. skills that failed to load entirely)""" warnings: list[str] """Warnings emitted while loading skills (e.g. skills that loaded but had issues)""" @staticmethod def from_dict(obj: Any) -> 'SkillsLoadDiagnostics': assert isinstance(obj, dict) errors = from_list(from_str, obj.get("errors")) warnings = from_list(from_str, obj.get("warnings")) return SkillsLoadDiagnostics(errors, warnings) def to_dict(self) -> dict: result: dict = {} result["errors"] = from_list(from_str, self.errors) result["warnings"] = from_list(from_str, self.warnings) return result class SlashCommandAgentPromptResultKind(Enum): AGENT_PROMPT = "agent-prompt" class SlashCommandCompletedResultKind(Enum): COMPLETED = "completed" class SlashCommandInvocationResultKind(Enum): AGENT_PROMPT = "agent-prompt" COMPLETED = "completed" SELECT_SUBCOMMAND = "select-subcommand" TEXT = "text" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandSelectSubcommandOption: """Schema for the `SlashCommandSelectSubcommandOption` type.""" description: str """Human-readable description of the subcommand""" name: str """Subcommand name to invoke""" group: str | None = None """Optional group label for organizing options""" @staticmethod def from_dict(obj: Any) -> 'SlashCommandSelectSubcommandOption': assert isinstance(obj, dict) description = from_str(obj.get("description")) name = from_str(obj.get("name")) group = from_union([from_str, from_none], obj.get("group")) return SlashCommandSelectSubcommandOption(description, name, group) def to_dict(self) -> dict: result: dict = {} result["description"] = from_str(self.description) result["name"] = from_str(self.name) if self.group is not None: result["group"] = from_union([from_str, from_none], self.group) return result class SlashCommandSelectSubcommandResultKind(Enum): SELECT_SUBCOMMAND = "select-subcommand" # Experimental: this type is part of an experimental API and may change or be removed. class SubagentSettingsEntryContextTier(Enum): """Context tier override for matching subagents""" DEFAULT = "default" INHERIT = "inherit" LONG_CONTEXT = "long_context" # Experimental: this type is part of an experimental API and may change or be removed. class TaskExecutionMode(Enum): """Whether task execution is synchronously awaited or managed in the background""" BACKGROUND = "background" SYNC = "sync" # Experimental: this type is part of an experimental API and may change or be removed. class TaskStatus(Enum): """Current lifecycle status of the task""" CANCELLED = "cancelled" COMPLETED = "completed" FAILED = "failed" IDLE = "idle" RUNNING = "running" class TaskAgentInfoType(Enum): AGENT = "agent" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskProgressLine: """Schema for the `TaskProgressLine` type.""" message: str """Display message, e.g., "▸ bash", "✓ edit src/foo.ts\"""" timestamp: datetime """ISO 8601 timestamp when this event occurred""" @staticmethod def from_dict(obj: Any) -> 'TaskProgressLine': assert isinstance(obj, dict) message = from_str(obj.get("message")) timestamp = from_datetime(obj.get("timestamp")) return TaskProgressLine(message, timestamp) def to_dict(self) -> dict: result: dict = {} result["message"] = from_str(self.message) result["timestamp"] = self.timestamp.isoformat() return result # Experimental: this type is part of an experimental API and may change or be removed. class TaskShellInfoAttachmentMode(Enum): """Whether the shell runs inside a managed PTY session or as an independent background process """ ATTACHED = "attached" DETACHED = "detached" class TaskInfoType(Enum): AGENT = "agent" SHELL = "shell" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskList: """Background tasks currently tracked by the session.""" tasks: list[TaskInfo] """Currently tracked tasks""" @staticmethod def from_dict(obj: Any) -> 'TaskList': assert isinstance(obj, dict) tasks = from_list(_load_TaskInfo, obj.get("tasks")) return TaskList(tasks) def to_dict(self) -> dict: result: dict = {} result["tasks"] = from_list(lambda x: (x).to_dict(), self.tasks) return result class TaskShellInfoType(Enum): SHELL = "shell" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksCancelRequest: """Identifier of the background task to cancel.""" id: str """Task identifier""" @staticmethod def from_dict(obj: Any) -> 'TasksCancelRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksCancelRequest(id) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksCancelResult: """Indicates whether the background task was successfully cancelled.""" cancelled: bool """Whether the task was successfully cancelled""" @staticmethod def from_dict(obj: Any) -> 'TasksCancelResult': assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return TasksCancelResult(cancelled) def to_dict(self) -> dict: result: dict = {} result["cancelled"] = from_bool(self.cancelled) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetCurrentPromotableResult: """The first sync-waiting task that can currently be promoted to background mode.""" task: TaskInfo | None = None """The first sync-waiting task (agent first, then shell) that can currently be promoted to background mode. Omitted if no such task exists. The returned task is guaranteed to have executionMode='sync' and canPromoteToBackground=true at the time of the call. """ @staticmethod def from_dict(obj: Any) -> 'TasksGetCurrentPromotableResult': assert isinstance(obj, dict) task = from_union([_load_TaskInfo, from_none], obj.get("task")) return TasksGetCurrentPromotableResult(task) def to_dict(self) -> dict: result: dict = {} if self.task is not None: result["task"] = from_union([lambda x: (x).to_dict(), from_none], self.task) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetProgressRequest: """Identifier of the background task to fetch progress for.""" id: str """Task identifier (agent ID or shell ID)""" @staticmethod def from_dict(obj: Any) -> 'TasksGetProgressRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksGetProgressRequest(id) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteCurrentToBackgroundResult: """The promoted task as it now exists in background mode, omitted if no promotable task was waiting. """ task: TaskInfo | None = None """The promoted task as it now exists in background mode, omitted if no promotable task was waiting. Atomic operation: avoids the race window of getCurrentPromotable + promoteToBackground. """ @staticmethod def from_dict(obj: Any) -> 'TasksPromoteCurrentToBackgroundResult': assert isinstance(obj, dict) task = from_union([_load_TaskInfo, from_none], obj.get("task")) return TasksPromoteCurrentToBackgroundResult(task) def to_dict(self) -> dict: result: dict = {} if self.task is not None: result["task"] = from_union([lambda x: (x).to_dict(), from_none], self.task) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteToBackgroundRequest: """Identifier of the task to promote to background mode.""" id: str """Task identifier""" @staticmethod def from_dict(obj: Any) -> 'TasksPromoteToBackgroundRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksPromoteToBackgroundRequest(id) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteToBackgroundResult: """Indicates whether the task was successfully promoted to background mode.""" promoted: bool """Whether the task was successfully promoted to background mode""" @staticmethod def from_dict(obj: Any) -> 'TasksPromoteToBackgroundResult': assert isinstance(obj, dict) promoted = from_bool(obj.get("promoted")) return TasksPromoteToBackgroundResult(promoted) def to_dict(self) -> dict: result: dict = {} result["promoted"] = from_bool(self.promoted) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRefreshResult: """Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop. """ @staticmethod def from_dict(obj: Any) -> 'TasksRefreshResult': assert isinstance(obj, dict) return TasksRefreshResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRemoveRequest: """Identifier of the completed or cancelled task to remove from tracking.""" id: str """Task identifier""" @staticmethod def from_dict(obj: Any) -> 'TasksRemoveRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksRemoveRequest(id) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRemoveResult: """Indicates whether the task was removed. False when the task does not exist or is still running/idle. """ removed: bool """Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). """ @staticmethod def from_dict(obj: Any) -> 'TasksRemoveResult': assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return TasksRemoveResult(removed) def to_dict(self) -> dict: result: dict = {} result["removed"] = from_bool(self.removed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksSendMessageRequest: """Identifier of the target agent task, message content, and optional sender agent ID.""" id: str """Agent task identifier""" message: str """Message content to send to the agent""" from_agent_id: str | None = None """Agent ID of the sender, if sent on behalf of another agent""" @staticmethod def from_dict(obj: Any) -> 'TasksSendMessageRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) message = from_str(obj.get("message")) from_agent_id = from_union([from_str, from_none], obj.get("fromAgentId")) return TasksSendMessageRequest(id, message, from_agent_id) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) result["message"] = from_str(self.message) if self.from_agent_id is not None: result["fromAgentId"] = from_union([from_str, from_none], self.from_agent_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksSendMessageResult: """Indicates whether the message was delivered, with an error message when delivery failed.""" sent: bool """Whether the message was successfully delivered or steered""" error: str | None = None """Error message if delivery failed""" @staticmethod def from_dict(obj: Any) -> 'TasksSendMessageResult': assert isinstance(obj, dict) sent = from_bool(obj.get("sent")) error = from_union([from_str, from_none], obj.get("error")) return TasksSendMessageResult(sent, error) def to_dict(self) -> dict: result: dict = {} result["sent"] = from_bool(self.sent) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksStartAgentRequest: """Agent type, prompt, name, and optional description and model override for the new task.""" agent_type: str """Type of agent to start (e.g., 'explore', 'task', 'general-purpose')""" name: str """Short name for the agent, used to generate a human-readable ID""" prompt: str """Task prompt for the agent""" description: str | None = None """Short description of the task""" model: str | None = None """Optional model override""" @staticmethod def from_dict(obj: Any) -> 'TasksStartAgentRequest': assert isinstance(obj, dict) agent_type = from_str(obj.get("agentType")) name = from_str(obj.get("name")) prompt = from_str(obj.get("prompt")) description = from_union([from_str, from_none], obj.get("description")) model = from_union([from_str, from_none], obj.get("model")) return TasksStartAgentRequest(agent_type, name, prompt, description, model) def to_dict(self) -> dict: result: dict = {} result["agentType"] = from_str(self.agent_type) result["name"] = from_str(self.name) result["prompt"] = from_str(self.prompt) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksStartAgentResult: """Identifier assigned to the newly started background agent task.""" agent_id: str """Generated agent ID for the background task""" @staticmethod def from_dict(obj: Any) -> 'TasksStartAgentResult': assert isinstance(obj, dict) agent_id = from_str(obj.get("agentId")) return TasksStartAgentResult(agent_id) def to_dict(self) -> dict: result: dict = {} result["agentId"] = from_str(self.agent_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksWaitForPendingResult: """Wait until all in-flight background tasks (agents + shells) and any follow-up turns scheduled by their completions have settled. Returns when the runtime is fully drained or after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS). """ @staticmethod def from_dict(obj: Any) -> 'TasksWaitForPendingResult': assert isinstance(obj, dict) return TasksWaitForPendingResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TelemetrySetFeatureOverridesRequest: """Feature override key/value pairs to attach to subsequent telemetry events from this session. """ features: dict[str, str] """Override key/value pairs to attach to subsequent telemetry events from this session. Replaces any previously-set overrides. """ @staticmethod def from_dict(obj: Any) -> 'TelemetrySetFeatureOverridesRequest': assert isinstance(obj, dict) features = from_dict(from_str, obj.get("features")) return TelemetrySetFeatureOverridesRequest(features) def to_dict(self) -> dict: result: dict = {} result["features"] = from_dict(from_str, self.features) return result class TokenAuthInfoType(Enum): TOKEN = "token" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Tool: """Schema for the `Tool` type.""" description: str """Description of what the tool does""" name: str """Tool identifier (e.g., "bash", "grep", "str_replace_editor")""" instructions: str | None = None """Optional instructions for how to use this tool effectively""" namespaced_name: str | None = None """Optional namespaced name for declarative filtering (e.g., "playwright/navigate" for MCP tools) """ parameters: dict[str, Any] | None = None """JSON Schema for the tool's input parameters""" @staticmethod def from_dict(obj: Any) -> 'Tool': assert isinstance(obj, dict) description = from_str(obj.get("description")) name = from_str(obj.get("name")) instructions = from_union([from_str, from_none], obj.get("instructions")) namespaced_name = from_union([from_str, from_none], obj.get("namespacedName")) parameters = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("parameters")) return Tool(description, name, instructions, namespaced_name, parameters) def to_dict(self) -> dict: result: dict = {} result["description"] = from_str(self.description) result["name"] = from_str(self.name) if self.instructions is not None: result["instructions"] = from_union([from_str, from_none], self.instructions) if self.namespaced_name is not None: result["namespacedName"] = from_union([from_str, from_none], self.namespaced_name) if self.parameters is not None: result["parameters"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.parameters) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ToolsInitializeAndValidateResult: """Resolve, build, and validate the runtime tool list for this session. Subagent sessions and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation. """ @staticmethod def from_dict(obj: Any) -> 'ToolsInitializeAndValidateResult': assert isinstance(obj, dict) return ToolsInitializeAndValidateResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ToolsListRequest: """Optional model identifier whose tool overrides should be applied to the listing.""" model: str | None = None """Optional model ID — when provided, the returned tool list reflects model-specific overrides """ @staticmethod def from_dict(obj: Any) -> 'ToolsListRequest': assert isinstance(obj, dict) model = from_union([from_str, from_none], obj.get("model")) return ToolsListRequest(model) def to_dict(self) -> dict: result: dict = {} if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ToolsUpdateSubagentSettingsResult: """Empty result after applying subagent settings""" @staticmethod def from_dict(obj: Any) -> 'ToolsUpdateSubagentSettingsResult': assert isinstance(obj, dict) return ToolsUpdateSubagentSettingsResult() def to_dict(self) -> dict: result: dict = {} return result # Experimental: this type is part of an experimental API and may change or be removed. class UIAutoModeSwitchResponse(Enum): """User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). """ NO = "no" YES = "yes" YES_ALWAYS = "yes_always" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfFieldItemsAnyOf: """Schema for the `UIElicitationArrayAnyOfFieldItemsAnyOf` type.""" const: str """Value submitted when this option is selected.""" title: str """Display label for this option.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfFieldItemsAnyOf': assert isinstance(obj, dict) const = from_str(obj.get("const")) title = from_str(obj.get("title")) return UIElicitationArrayAnyOfFieldItemsAnyOf(const, title) def to_dict(self) -> dict: result: dict = {} result["const"] = from_str(self.const) result["title"] = from_str(self.title) return result class UIElicitationArrayAnyOfFieldType(Enum): ARRAY = "array" class UIElicitationArrayEnumFieldItemsType(Enum): STRING = "string" # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationSchemaPropertyStringFormat(Enum): """Optional format hint that constrains the accepted input.""" DATE = "date" DATE_TIME = "date-time" EMAIL = "email" URI = "uri" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringOneOfFieldOneOf: """Schema for the `UIElicitationStringOneOfFieldOneOf` type.""" const: str """Value submitted when this option is selected.""" title: str """Display label for this option.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationStringOneOfFieldOneOf': assert isinstance(obj, dict) const = from_str(obj.get("const")) title = from_str(obj.get("title")) return UIElicitationStringOneOfFieldOneOf(const, title) def to_dict(self) -> dict: result: dict = {} result["const"] = from_str(self.const) result["title"] = from_str(self.title) return result class UIElicitationSchemaPropertyType(Enum): """Numeric type accepted by the field.""" ARRAY = "array" BOOLEAN = "boolean" INTEGER = "integer" NUMBER = "number" STRING = "string" class UIElicitationSchemaType(Enum): OBJECT = "object" # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationResponseAction(Enum): """The user's response: accept (submitted), decline (rejected), or cancel (dismissed)""" ACCEPT = "accept" CANCEL = "cancel" DECLINE = "decline" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationResult: """Indicates whether the elicitation response was accepted; false if it was already resolved by another client. """ success: bool """Whether the response was accepted. False if the request was already resolved by another client. """ @staticmethod def from_dict(obj: Any) -> 'UIElicitationResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return UIElicitationResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result class UIElicitationSchemaPropertyBooleanType(Enum): BOOLEAN = "boolean" # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationSchemaPropertyNumberType(Enum): """Numeric type accepted by the field.""" INTEGER = "integer" NUMBER = "number" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIEphemeralQueryResult: """Transient answer generated from current conversation context.""" answer: str """Full assistant response text.""" @staticmethod def from_dict(obj: Any) -> 'UIEphemeralQueryResult': assert isinstance(obj, dict) answer = from_str(obj.get("answer")) return UIEphemeralQueryResult(answer) def to_dict(self) -> dict: result: dict = {} result["answer"] = from_str(self.answer) return result # Experimental: this type is part of an experimental API and may change or be removed. class UIExitPlanModeAction(Enum): """The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. """ AUTOPILOT = "autopilot" AUTOPILOT_FLEET = "autopilot_fleet" EXIT_ONLY = "exit_only" INTERACTIVE = "interactive" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingResult: """Indicates whether the pending UI request was resolved by this call.""" success: bool """True if the request was still pending and was resolved by this call. False if the request ID was unknown, already resolved by another client (e.g. GitHub), expired, or otherwise no longer pending. """ @staticmethod def from_dict(obj: Any) -> 'UIHandlePendingResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return UIHandlePendingResult(success) def to_dict(self) -> dict: result: dict = {} result["success"] = from_bool(self.success) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingSamplingRequest: """Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). """ request_id: str """The unique request ID from the sampling.requested event""" response: dict[str, Any] | None = None """Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. """ @staticmethod def from_dict(obj: Any) -> 'UIHandlePendingSamplingRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("response")) return UIHandlePendingSamplingRequest(request_id, response) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) if self.response is not None: result["response"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.response) return result # Experimental: this type is part of an experimental API and may change or be removed. class UISessionLimitsExhaustedResponseAction(Enum): """Action selected by the user. User action selected for an exhausted session limit. """ ADD = "add" CANCEL = "cancel" SET = "set" UNSET = "unset" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUserInputResponse: """Schema for the `UIUserInputResponse` type.""" answer: str """The user's answer text""" was_freeform: bool """True if the user typed a freeform response, false if they selected a presented choice. Used by telemetry to differentiate between free text input and choice selection. """ @staticmethod def from_dict(obj: Any) -> 'UIUserInputResponse': assert isinstance(obj, dict) answer = from_str(obj.get("answer")) was_freeform = from_bool(obj.get("wasFreeform")) return UIUserInputResponse(answer, was_freeform) def to_dict(self) -> dict: result: dict = {} result["answer"] = from_str(self.answer) result["wasFreeform"] = from_bool(self.was_freeform) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIRegisterDirectAutoModeSwitchHandlerResult: """Register an in-process handler for `auto_mode_switch.requested` events. The caller still attaches the actual listener via the standard event-subscription mechanism; this registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId). """ handle: str """Opaque handle representing the registration. Pass this same handle to `unregisterDirectAutoModeSwitchHandler` when the in-process handler is no longer active. Multiple registrations are reference-counted; the server bridge will only dispatch auto-mode-switch requests when no handles are active. """ @staticmethod def from_dict(obj: Any) -> 'UIRegisterDirectAutoModeSwitchHandlerResult': assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return UIRegisterDirectAutoModeSwitchHandlerResult(handle) def to_dict(self) -> dict: result: dict = {} result["handle"] = from_str(self.handle) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUnregisterDirectAutoModeSwitchHandlerRequest: """Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release.""" handle: str """Handle previously returned by `registerDirectAutoModeSwitchHandler`""" @staticmethod def from_dict(obj: Any) -> 'UIUnregisterDirectAutoModeSwitchHandlerRequest': assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return UIUnregisterDirectAutoModeSwitchHandlerRequest(handle) def to_dict(self) -> dict: result: dict = {} result["handle"] = from_str(self.handle) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUnregisterDirectAutoModeSwitchHandlerResult: """Indicates whether the handle was active and the registration count was decremented.""" unregistered: bool """True if the handle was active and decremented the counter; false if the handle was unknown. """ @staticmethod def from_dict(obj: Any) -> 'UIUnregisterDirectAutoModeSwitchHandlerResult': assert isinstance(obj, dict) unregistered = from_bool(obj.get("unregistered")) return UIUnregisterDirectAutoModeSwitchHandlerResult(unregistered) def to_dict(self) -> dict: result: dict = {} result["unregistered"] = from_bool(self.unregistered) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsCodeChanges: """Aggregated code change metrics""" files_modified: list[str] """Distinct file paths modified during the session""" files_modified_count: int """Number of distinct files modified""" lines_added: int """Total lines of code added""" lines_removed: int """Total lines of code removed""" @staticmethod def from_dict(obj: Any) -> 'UsageMetricsCodeChanges': assert isinstance(obj, dict) files_modified = from_list(from_str, obj.get("filesModified")) files_modified_count = from_int(obj.get("filesModifiedCount")) lines_added = from_int(obj.get("linesAdded")) lines_removed = from_int(obj.get("linesRemoved")) return UsageMetricsCodeChanges(files_modified, files_modified_count, lines_added, lines_removed) def to_dict(self) -> dict: result: dict = {} result["filesModified"] = from_list(from_str, self.files_modified) result["filesModifiedCount"] = from_int(self.files_modified_count) result["linesAdded"] = from_int(self.lines_added) result["linesRemoved"] = from_int(self.lines_removed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricRequests: """Request count and cost metrics for this model""" cost: float """User-initiated premium request cost (with multiplier applied)""" count: int """Number of API requests made with this model""" @staticmethod def from_dict(obj: Any) -> 'UsageMetricsModelMetricRequests': assert isinstance(obj, dict) cost = from_float(obj.get("cost")) count = from_int(obj.get("count")) return UsageMetricsModelMetricRequests(cost, count) def to_dict(self) -> dict: result: dict = {} result["cost"] = to_float(self.cost) result["count"] = from_int(self.count) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricTokenDetail: """Schema for the `UsageMetricsModelMetricTokenDetail` type.""" token_count: int """Accumulated token count for this token type""" @staticmethod def from_dict(obj: Any) -> 'UsageMetricsModelMetricTokenDetail': assert isinstance(obj, dict) token_count = from_int(obj.get("tokenCount")) return UsageMetricsModelMetricTokenDetail(token_count) def to_dict(self) -> dict: result: dict = {} result["tokenCount"] = from_int(self.token_count) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricUsage: """Token usage metrics for this model""" cache_read_tokens: int """Total tokens read from prompt cache""" cache_write_tokens: int """Total tokens written to prompt cache""" input_tokens: int """Total input tokens consumed""" output_tokens: int """Total output tokens produced""" reasoning_tokens: int | None = None """Total output tokens used for reasoning""" @staticmethod def from_dict(obj: Any) -> 'UsageMetricsModelMetricUsage': assert isinstance(obj, dict) cache_read_tokens = from_int(obj.get("cacheReadTokens")) cache_write_tokens = from_int(obj.get("cacheWriteTokens")) input_tokens = from_int(obj.get("inputTokens")) output_tokens = from_int(obj.get("outputTokens")) reasoning_tokens = from_union([from_int, from_none], obj.get("reasoningTokens")) return UsageMetricsModelMetricUsage(cache_read_tokens, cache_write_tokens, input_tokens, output_tokens, reasoning_tokens) def to_dict(self) -> dict: result: dict = {} result["cacheReadTokens"] = from_int(self.cache_read_tokens) result["cacheWriteTokens"] = from_int(self.cache_write_tokens) result["inputTokens"] = from_int(self.input_tokens) result["outputTokens"] = from_int(self.output_tokens) if self.reasoning_tokens is not None: result["reasoningTokens"] = from_union([from_int, from_none], self.reasoning_tokens) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsTokenDetail: """Schema for the `UsageMetricsTokenDetail` type.""" token_count: int """Accumulated token count for this token type""" @staticmethod def from_dict(obj: Any) -> 'UsageMetricsTokenDetail': assert isinstance(obj, dict) token_count = from_int(obj.get("tokenCount")) return UsageMetricsTokenDetail(token_count) def to_dict(self) -> dict: result: dict = {} result["tokenCount"] = from_int(self.token_count) return result class UserAuthInfoType(Enum): USER = "user" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserSettingMetadata: """A single user setting's effective value alongside its default, so consumers can render settings left at their default. """ default: Any """The centrally-known default for this setting (null when no default is registered).""" is_default: bool """True when the user has not set an explicit value for this setting (i.e. it is left at its default). Reflects whether the user has overridden the key, not whether the effective value happens to equal the default — a key explicitly set to a value identical to the default still reports false. """ value: Any """The effective value: the user's value if set, otherwise the default.""" @staticmethod def from_dict(obj: Any) -> 'UserSettingMetadata': assert isinstance(obj, dict) default = obj.get("default") is_default = from_bool(obj.get("isDefault")) value = obj.get("value") return UserSettingMetadata(default, is_default, value) def to_dict(self) -> dict: result: dict = {} result["default"] = self.default result["isDefault"] = from_bool(self.is_default) result["value"] = self.value return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserSettingsSetRequest: """Partial user settings to write to settings.json. Each top-level key is written individually, replacing the existing value; a key whose value is null is removed. """ settings: Any """Partial user settings to write, as a free-form object keyed by setting name""" @staticmethod def from_dict(obj: Any) -> 'UserSettingsSetRequest': assert isinstance(obj, dict) settings = obj.get("settings") return UserSettingsSetRequest(settings) def to_dict(self) -> dict: result: dict = {} result["settings"] = self.settings return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserSettingsSetResult: """Outcome of writing user settings.""" shadowed_keys: list[str] """Top-level keys whose write landed in settings.json but is shadowed by a value still present in the legacy config.json (config.json wins on read). The write does not take effect until the legacy value is removed. """ @staticmethod def from_dict(obj: Any) -> 'UserSettingsSetResult': assert isinstance(obj, dict) shadowed_keys = from_list(from_str, obj.get("shadowedKeys")) return UserSettingsSetResult(shadowed_keys) def to_dict(self) -> dict: result: dict = {} result["shadowedKeys"] = from_list(from_str, self.shadowed_keys) return result # Experimental: this type is part of an experimental API and may change or be removed. class WorkspaceDiffFileChangeType(Enum): """Type of change represented by this file diff.""" ADDED = "added" DELETED = "deleted" MODIFIED = "modified" RENAMED = "renamed" # Experimental: this type is part of an experimental API and may change or be removed. class WorkspaceDiffMode(Enum): """Diff mode requested by the client. Effective mode used for the returned changes. """ BRANCH = "branch" SESSION = "session" UNSTAGED = "unstaged" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesCheckpoints: """Schema for the `WorkspacesCheckpoints` type.""" filename: str """Filename of the checkpoint within the workspace checkpoints directory""" number: int """Checkpoint number assigned by the workspace manager""" title: str """Human-readable checkpoint title""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesCheckpoints': assert isinstance(obj, dict) filename = from_str(obj.get("filename")) number = from_int(obj.get("number")) title = from_str(obj.get("title")) return WorkspacesCheckpoints(filename, number, title) def to_dict(self) -> dict: result: dict = {} result["filename"] = from_str(self.filename) result["number"] = from_int(self.number) result["title"] = from_str(self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesCreateFileRequest: """Relative path and UTF-8 content for the workspace file to create or overwrite.""" content: str """File content to write as a UTF-8 string""" path: str """Relative path within the workspace files directory""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesCreateFileRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) return WorkspacesCreateFileRequest(content, path) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesListFilesResult: """Relative paths of files stored in the session workspace files directory.""" files: list[str] """Relative file paths in the workspace files directory""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesListFilesResult': assert isinstance(obj, dict) files = from_list(from_str, obj.get("files")) return WorkspacesListFilesResult(files) def to_dict(self) -> dict: result: dict = {} result["files"] = from_list(from_str, self.files) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadCheckpointRequest: """Checkpoint number to read.""" number: int """Checkpoint number to read""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesReadCheckpointRequest': assert isinstance(obj, dict) number = from_int(obj.get("number")) return WorkspacesReadCheckpointRequest(number) def to_dict(self) -> dict: result: dict = {} result["number"] = from_int(self.number) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadCheckpointResult: """Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing.""" content: str | None = None """Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesReadCheckpointResult': assert isinstance(obj, dict) content = from_union([from_none, from_str], obj.get("content")) return WorkspacesReadCheckpointResult(content) def to_dict(self) -> dict: result: dict = {} result["content"] = from_union([from_none, from_str], self.content) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadFileRequest: """Relative path of the workspace file to read.""" path: str """Relative path within the workspace files directory""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesReadFileRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) return WorkspacesReadFileRequest(path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadFileResult: """Contents of the requested workspace file as a UTF-8 string.""" content: str """File content as a UTF-8 string""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesReadFileResult': assert isinstance(obj, dict) content = from_str(obj.get("content")) return WorkspacesReadFileResult(content) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesSaveLargePasteRequest: """Pasted content to save as a UTF-8 file in the session workspace.""" content: str """Pasted content to save as a UTF-8 file""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesSaveLargePasteRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) return WorkspacesSaveLargePasteRequest(content) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) return result @dataclass class Saved: filename: str """Filename within the workspace files directory""" file_path: str """Absolute filesystem path to the saved paste file""" size_bytes: int """Size of the saved file in bytes""" @staticmethod def from_dict(obj: Any) -> 'Saved': assert isinstance(obj, dict) filename = from_str(obj.get("filename")) file_path = from_str(obj.get("filePath")) size_bytes = from_int(obj.get("sizeBytes")) return Saved(filename, file_path, size_bytes) def to_dict(self) -> dict: result: dict = {} result["filename"] = from_str(self.filename) result["filePath"] = from_str(self.file_path) result["sizeBytes"] = from_int(self.size_bytes) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionAuthStatus: """Authentication status and account metadata for the session.""" is_authenticated: bool """Whether the session has resolved authentication""" auth_type: AuthInfoType | None = None """Authentication type""" copilot_plan: str | None = None """Copilot plan tier (e.g., individual_pro, business)""" host: str | None = None """Authentication host URL""" login: str | None = None """Authenticated login/username, if available""" status_message: str | None = None """Human-readable authentication status description""" @staticmethod def from_dict(obj: Any) -> 'SessionAuthStatus': assert isinstance(obj, dict) is_authenticated = from_bool(obj.get("isAuthenticated")) auth_type = from_union([AuthInfoType, from_none], obj.get("authType")) copilot_plan = from_union([from_str, from_none], obj.get("copilotPlan")) host = from_union([from_str, from_none], obj.get("host")) login = from_union([from_str, from_none], obj.get("login")) status_message = from_union([from_str, from_none], obj.get("statusMessage")) return SessionAuthStatus(is_authenticated, auth_type, copilot_plan, host, login, status_message) def to_dict(self) -> dict: result: dict = {} result["isAuthenticated"] = from_bool(self.is_authenticated) if self.auth_type is not None: result["authType"] = from_union([lambda x: to_enum(AuthInfoType, x), from_none], self.auth_type) if self.copilot_plan is not None: result["copilotPlan"] = from_union([from_str, from_none], self.copilot_plan) if self.host is not None: result["host"] = from_union([from_str, from_none], self.host) if self.login is not None: result["login"] = from_union([from_str, from_none], self.login) if self.status_message is not None: result["statusMessage"] = from_union([from_str, from_none], self.status_message) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AccountGetQuotaResult: """Quota usage snapshots for the resolved user, keyed by quota type.""" quota_snapshots: dict[str, AccountQuotaSnapshot] """Quota snapshots keyed by type (e.g., chat, completions, premium_interactions)""" @staticmethod def from_dict(obj: Any) -> 'AccountGetQuotaResult': assert isinstance(obj, dict) quota_snapshots = from_dict(AccountQuotaSnapshot.from_dict, obj.get("quotaSnapshots")) return AccountGetQuotaResult(quota_snapshots) def to_dict(self) -> dict: result: dict = {} result["quotaSnapshots"] = from_dict(lambda x: to_class(AccountQuotaSnapshot, x), self.quota_snapshots) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesSupports: """Feature flags indicating what the model supports""" adaptive_thinking: AdaptiveThinkingSupport | None = None """Resolved Anthropic adaptive-thinking capability — unsupported / optional / required. 'required' models reject thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8). """ reasoning_effort: bool | None = None """Whether this model supports reasoning effort configuration""" vision: bool | None = None """Whether this model supports vision/image input""" @staticmethod def from_dict(obj: Any) -> 'ModelCapabilitiesSupports': assert isinstance(obj, dict) adaptive_thinking = from_union([AdaptiveThinkingSupport, from_none], obj.get("adaptive_thinking")) reasoning_effort = from_union([from_bool, from_none], obj.get("reasoningEffort")) vision = from_union([from_bool, from_none], obj.get("vision")) return ModelCapabilitiesSupports(adaptive_thinking, reasoning_effort, vision) def to_dict(self) -> dict: result: dict = {} if self.adaptive_thinking is not None: result["adaptive_thinking"] = from_union([lambda x: to_enum(AdaptiveThinkingSupport, x), from_none], self.adaptive_thinking) if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_bool, from_none], self.reasoning_effort) if self.vision is not None: result["vision"] = from_union([from_bool, from_none], self.vision) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideSupports: """Feature flags indicating what the model supports""" adaptive_thinking: AdaptiveThinkingSupport | None = None """Resolved Anthropic adaptive-thinking capability — unsupported / optional / required. 'required' models reject thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8). """ reasoning_effort: bool | None = None """Whether this model supports reasoning effort configuration""" vision: bool | None = None """Whether this model supports vision/image input""" @staticmethod def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideSupports': assert isinstance(obj, dict) adaptive_thinking = from_union([AdaptiveThinkingSupport, from_none], obj.get("adaptive_thinking")) reasoning_effort = from_union([from_bool, from_none], obj.get("reasoningEffort")) vision = from_union([from_bool, from_none], obj.get("vision")) return ModelCapabilitiesOverrideSupports(adaptive_thinking, reasoning_effort, vision) def to_dict(self) -> dict: result: dict = {} if self.adaptive_thinking is not None: result["adaptive_thinking"] = from_union([lambda x: to_enum(AdaptiveThinkingSupport, x), from_none], self.adaptive_thinking) if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_bool, from_none], self.reasoning_effort) if self.vision is not None: result["vision"] = from_union([from_bool, from_none], self.vision) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentDiscoveryPath: """Schema for the `AgentDiscoveryPath` type.""" path: str """Absolute path of the search/create directory (may not exist on disk yet)""" preferred_for_creation: bool """Whether this is the canonical directory to create a new agent in its tier. At most one entry per tier is preferred. """ scope: AgentDiscoveryPathScope """Which tier this directory belongs to""" project_path: str | None = None """The input project path this directory was derived from (only for project scope)""" @staticmethod def from_dict(obj: Any) -> 'AgentDiscoveryPath': assert isinstance(obj, dict) path = from_str(obj.get("path")) preferred_for_creation = from_bool(obj.get("preferredForCreation")) scope = AgentDiscoveryPathScope(obj.get("scope")) project_path = from_union([from_str, from_none], obj.get("projectPath")) return AgentDiscoveryPath(path, preferred_for_creation, scope, project_path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["preferredForCreation"] = from_bool(self.preferred_for_creation) result["scope"] = to_enum(AgentDiscoveryPathScope, self.scope) if self.project_path is not None: result["projectPath"] = from_union([from_str, from_none], self.project_path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentRegistryLogCapture: """Per-spawn log-capture outcome; populated from spawnLiveTarget.""" enabled: bool """Whether per-spawn log capture is on (false when env-disabled or open failed)""" open_error: str | None = None """Human-readable open failure message (only set when enabled === false AND the env-disable opt-out was NOT used) """ open_error_reason: AgentRegistryLogCaptureOpenErrorReason | None = None """Categorized reason for log-open failure""" path: str | None = None """Absolute path to the per-spawn log file (only set when enabled)""" @staticmethod def from_dict(obj: Any) -> 'AgentRegistryLogCapture': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) open_error = from_union([from_str, from_none], obj.get("openError")) open_error_reason = from_union([AgentRegistryLogCaptureOpenErrorReason, from_none], obj.get("openErrorReason")) path = from_union([from_str, from_none], obj.get("path")) return AgentRegistryLogCapture(enabled, open_error, open_error_reason, path) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) if self.open_error is not None: result["openError"] = from_union([from_str, from_none], self.open_error) if self.open_error_reason is not None: result["openErrorReason"] = from_union([lambda x: to_enum(AgentRegistryLogCaptureOpenErrorReason, x), from_none], self.open_error_reason) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentRegistrySpawnError: """`child_process.spawn` itself failed before the child entered the registry.""" kind: ClassVar[str] = "spawn-error" """Discriminator: child_process.spawn itself failed""" message: str """Human-readable error message""" code: str | None = None """Underlying errno code (e.g. ENOENT, EACCES) when available""" @staticmethod def from_dict(obj: Any) -> 'AgentRegistrySpawnError': assert isinstance(obj, dict) message = from_str(obj.get("message")) code = from_union([from_str, from_none], obj.get("code")) return AgentRegistrySpawnError(message, code) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["message"] = from_str(self.message) if self.code is not None: result["code"] = from_union([from_str, from_none], self.code) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentRegistrySpawnValidationError: """Synchronous pre-validation rejected the spawn request.""" kind: ClassVar[str] = "validation-error" """Discriminator: synchronous pre-validation rejected the request""" message: str """Human-readable explanation; safe to surface in the UI banner. Never logged to unrestricted telemetry. """ reason: AgentRegistrySpawnValidationErrorReason """Categorized reason for the rejection. Low-cardinality enum so telemetry can aggregate by reason without leaking raw paths or agent/model names. """ field: AgentRegistrySpawnValidationErrorField | None = None """Which parameter field was invalid. Omitted when the rejection is not field-specific.""" @staticmethod def from_dict(obj: Any) -> 'AgentRegistrySpawnValidationError': assert isinstance(obj, dict) message = from_str(obj.get("message")) reason = AgentRegistrySpawnValidationErrorReason(obj.get("reason")) field = from_union([AgentRegistrySpawnValidationErrorField, from_none], obj.get("field")) return AgentRegistrySpawnValidationError(message, reason, field) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["message"] = from_str(self.message) result["reason"] = to_enum(AgentRegistrySpawnValidationErrorReason, self.reason) if self.field is not None: result["field"] = from_union([lambda x: to_enum(AgentRegistrySpawnValidationErrorField, x), from_none], self.field) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class DiscoveredCanvas: """Canvas available in the current session.""" canvas_id: str """Provider-local canvas identifier""" description: str """Short, single-sentence description shown to the agent in canvas catalogs.""" display_name: str """Human-readable canvas name""" extension_id: str """Owning provider identifier""" actions: list[CanvasAction] | None = None """Actions the agent or host may invoke on an open instance""" extension_name: str | None = None """Owning extension display name, when available""" input_schema: Any = None """JSON Schema for canvas open input""" @staticmethod def from_dict(obj: Any) -> 'DiscoveredCanvas': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) description = from_str(obj.get("description")) display_name = from_str(obj.get("displayName")) extension_id = from_str(obj.get("extensionId")) actions = from_union([lambda x: from_list(CanvasAction.from_dict, x), from_none], obj.get("actions")) extension_name = from_union([from_str, from_none], obj.get("extensionName")) input_schema = obj.get("inputSchema") return DiscoveredCanvas(canvas_id, description, display_name, extension_id, actions, extension_name, input_schema) def to_dict(self) -> dict: result: dict = {} result["canvasId"] = from_str(self.canvas_id) result["description"] = from_str(self.description) result["displayName"] = from_str(self.display_name) result["extensionId"] = from_str(self.extension_id) if self.actions is not None: result["actions"] = from_union([lambda x: from_list(lambda x: to_class(CanvasAction, x), x), from_none], self.actions) if self.extension_name is not None: result["extensionName"] = from_union([from_str, from_none], self.extension_name) if self.input_schema is not None: result["inputSchema"] = self.input_schema return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasListOpenResult: """Live open-canvas snapshot.""" open_canvases: list[OpenCanvasInstance] """Currently open canvas instances""" @staticmethod def from_dict(obj: Any) -> 'CanvasListOpenResult': assert isinstance(obj, dict) open_canvases = from_list(OpenCanvasInstance.from_dict, obj.get("openCanvases")) return CanvasListOpenResult(open_canvases) def to_dict(self) -> dict: result: dict = {} result["openCanvases"] = from_list(lambda x: to_class(OpenCanvasInstance, x), self.open_canvases) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInput: """Optional unstructured input hint""" hint: str """Hint to display when command input has not been provided""" completion: SlashCommandInputCompletion | None = None """Optional completion hint for the input (e.g. 'directory' for filesystem path completion)""" preserve_multiline_input: bool | None = None """When true, clients should pass the full text after the command name as a single argument rather than splitting on whitespace """ required: bool | None = None """When true, the command requires non-empty input; clients should render the input hint as required """ @staticmethod def from_dict(obj: Any) -> 'SlashCommandInput': assert isinstance(obj, dict) hint = from_str(obj.get("hint")) completion = from_union([SlashCommandInputCompletion, from_none], obj.get("completion")) preserve_multiline_input = from_union([from_bool, from_none], obj.get("preserveMultilineInput")) required = from_union([from_bool, from_none], obj.get("required")) return SlashCommandInput(hint, completion, preserve_multiline_input, required) def to_dict(self) -> dict: result: dict = {} result["hint"] = from_str(self.hint) if self.completion is not None: result["completion"] = from_union([lambda x: to_enum(SlashCommandInputCompletion, x), from_none], self.completion) if self.preserve_multiline_input is not None: result["preserveMultilineInput"] = from_union([from_bool, from_none], self.preserve_multiline_input) if self.required is not None: result["required"] = from_union([from_bool, from_none], self.required) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentDirectory: """Directory attachment""" display_name: str """User-facing display name for the attachment""" path: str """Absolute directory path""" type: ClassVar[str] = "directory" """Attachment type discriminator""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentDirectory': assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) path = from_str(obj.get("path")) return PushAttachmentDirectory(display_name, path) def to_dict(self) -> dict: result: dict = {} result["displayName"] = from_str(self.display_name) result["path"] = from_str(self.path) result["type"] = self.type return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectedRemoteSessionMetadata: """Metadata for a connected remote session.""" kind: ConnectedRemoteSessionMetadataKind """Neutral SDK discriminator for the connected remote session kind.""" modified_time: datetime """Last session update time as an ISO 8601 string.""" repository: ConnectedRemoteSessionMetadataRepository """Repository associated with the connected remote session.""" session_id: str """SDK session ID for the connected remote session.""" start_time: datetime """Session start time as an ISO 8601 string.""" name: str | None = None """Optional friendly session name.""" pull_request_number: int | None = None """Pull request number associated with the session.""" resource_id: str | None = None """Original remote resource identifier.""" stale_at: datetime | None = None """Remote session staleness deadline as an ISO 8601 string.""" state: str | None = None """Remote session state returned by the backing service.""" summary: str | None = None """Optional session summary.""" @staticmethod def from_dict(obj: Any) -> 'ConnectedRemoteSessionMetadata': assert isinstance(obj, dict) kind = ConnectedRemoteSessionMetadataKind(obj.get("kind")) modified_time = from_datetime(obj.get("modifiedTime")) repository = ConnectedRemoteSessionMetadataRepository.from_dict(obj.get("repository")) session_id = from_str(obj.get("sessionId")) start_time = from_datetime(obj.get("startTime")) name = from_union([from_str, from_none], obj.get("name")) pull_request_number = from_union([from_int, from_none], obj.get("pullRequestNumber")) resource_id = from_union([from_str, from_none], obj.get("resourceId")) stale_at = from_union([from_datetime, from_none], obj.get("staleAt")) state = from_union([from_str, from_none], obj.get("state")) summary = from_union([from_str, from_none], obj.get("summary")) return ConnectedRemoteSessionMetadata(kind, modified_time, repository, session_id, start_time, name, pull_request_number, resource_id, stale_at, state, summary) def to_dict(self) -> dict: result: dict = {} result["kind"] = to_enum(ConnectedRemoteSessionMetadataKind, self.kind) result["modifiedTime"] = self.modified_time.isoformat() result["repository"] = to_class(ConnectedRemoteSessionMetadataRepository, self.repository) result["sessionId"] = from_str(self.session_id) result["startTime"] = self.start_time.isoformat() if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.pull_request_number is not None: result["pullRequestNumber"] = from_union([from_int, from_none], self.pull_request_number) if self.resource_id is not None: result["resourceId"] = from_union([from_str, from_none], self.resource_id) if self.stale_at is not None: result["staleAt"] = from_union([lambda x: x.isoformat(), from_none], self.stale_at) if self.state is not None: result["state"] = from_union([from_str, from_none], self.state) if self.summary is not None: result["summary"] = from_union([from_str, from_none], self.summary) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasHostContextCapabilities: """Host capabilities""" canvases: bool | None = None """Whether canvas rendering is supported""" @staticmethod def from_dict(obj: Any) -> 'CanvasHostContextCapabilities': assert isinstance(obj, dict) canvases = from_union([from_bool, from_none], obj.get("canvases")) return CanvasHostContextCapabilities(canvases) def to_dict(self) -> dict: result: dict = {} if self.canvases is not None: result["canvases"] = from_union([from_bool, from_none], self.canvases) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CompletionsRequestResult: """Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions. """ items: list[SessionCompletionItem] """Completion items in host-ranked order.""" @staticmethod def from_dict(obj: Any) -> 'CompletionsRequestResult': assert isinstance(obj, dict) items = from_list(SessionCompletionItem.from_dict, obj.get("items")) return CompletionsRequestResult(items) def to_dict(self) -> dict: result: dict = {} result["items"] = from_list(lambda x: to_class(SessionCompletionItem, x), self.items) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshots: """Schema for the `CopilotUserResponseQuotaSnapshotsChat` type. Schema for the `CopilotUserResponseQuotaSnapshotsCompletions` type. Schema for the `CopilotUserResponseQuotaSnapshotsPremiumInteractions` type. """ entitlement: float | None = None has_quota: bool | None = None overage_count: float | None = None overage_permitted: bool | None = None percent_remaining: float | None = None quota_id: str | None = None quota_remaining: float | None = None quota_reset_at: float | None = None remaining: float | None = None timestamp_utc: str | None = None token_based_billing: bool | None = None unlimited: bool | None = None @staticmethod def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshots': assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) overage_count = from_union([from_float, from_none], obj.get("overage_count")) overage_permitted = from_union([from_bool, from_none], obj.get("overage_permitted")) percent_remaining = from_union([from_float, from_none], obj.get("percent_remaining")) quota_id = from_union([from_str, from_none], obj.get("quota_id")) quota_remaining = from_union([from_float, from_none], obj.get("quota_remaining")) quota_reset_at = from_union([from_float, from_none], obj.get("quota_reset_at")) remaining = from_union([from_float, from_none], obj.get("remaining")) timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) return CopilotUserResponseQuotaSnapshots(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) def to_dict(self) -> dict: result: dict = {} if self.entitlement is not None: result["entitlement"] = from_union([to_float, from_none], self.entitlement) if self.has_quota is not None: result["has_quota"] = from_union([from_bool, from_none], self.has_quota) if self.overage_count is not None: result["overage_count"] = from_union([to_float, from_none], self.overage_count) if self.overage_permitted is not None: result["overage_permitted"] = from_union([from_bool, from_none], self.overage_permitted) if self.percent_remaining is not None: result["percent_remaining"] = from_union([to_float, from_none], self.percent_remaining) if self.quota_id is not None: result["quota_id"] = from_union([from_str, from_none], self.quota_id) if self.quota_remaining is not None: result["quota_remaining"] = from_union([to_float, from_none], self.quota_remaining) if self.quota_reset_at is not None: result["quota_reset_at"] = from_union([to_float, from_none], self.quota_reset_at) if self.remaining is not None: result["remaining"] = from_union([to_float, from_none], self.remaining) if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogReadRequest: """Cursor, batch size, and optional long-poll/filter parameters for reading session events.""" agent_scope: EventsAgentScope | None = None """Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. """ cursor: str | None = None """Opaque cursor returned by a previous read. Omit on the first call to start from the beginning of the session's persisted history. """ max: int | None = None """Maximum number of events to return in this batch (1–1000, default 200).""" types: list[str] | EventLogTypes | None = None """Either '*' to receive all event types, or a non-empty list of event types to receive""" wait_ms: int | None = None """Milliseconds to wait for new events when the cursor is at the tail of history. 0 (default) returns immediately even if no events are available. Capped at 30000ms. Ephemeral events that arrive during the wait are delivered in this batch but are NOT replayable on a subsequent read (use a non-zero waitMs in your next call to capture future ephemerals as they happen). """ @staticmethod def from_dict(obj: Any) -> 'EventLogReadRequest': assert isinstance(obj, dict) agent_scope = from_union([EventsAgentScope, from_none], obj.get("agentScope")) cursor = from_union([from_str, from_none], obj.get("cursor")) max = from_union([from_int, from_none], obj.get("max")) types = from_union([lambda x: from_list(from_str, x), EventLogTypes, from_none], obj.get("types")) wait_ms = from_union([from_int, from_none], obj.get("waitMs")) return EventLogReadRequest(agent_scope, cursor, max, types, wait_ms) def to_dict(self) -> dict: result: dict = {} if self.agent_scope is not None: result["agentScope"] = from_union([lambda x: to_enum(EventsAgentScope, x), from_none], self.agent_scope) if self.cursor is not None: result["cursor"] = from_union([from_str, from_none], self.cursor) if self.max is not None: result["max"] = from_union([from_int, from_none], self.max) if self.types is not None: result["types"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x), from_none], self.types) if self.wait_ms is not None: result["waitMs"] = from_union([from_int, from_none], self.wait_ms) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventsReadResult: """Batch of session events returned by a read, with cursor and continuation metadata.""" cursor: str """Opaque cursor for the next read. Pass back unchanged in the next read.cursor to continue from where this read left off. Always present, even when no events were returned. """ cursor_status: EventsCursorStatus """Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read started from the beginning of the remaining history. """ events: list[SessionEvent] """Events are delivered in two batches per read: persisted events first (in append order), then ephemeral events (in seq order). When `waitMs > 0` and the catch-up batches were empty, post-wait events follow the same two-batch ordering. Persisted and ephemeral events do not interleave within a single read. """ has_more: bool """True when the read returned `max` events and more events are available immediately. When false, the next read with a non-zero `waitMs` will block until a new event arrives or the wait expires. """ @staticmethod def from_dict(obj: Any) -> 'EventsReadResult': assert isinstance(obj, dict) cursor = from_str(obj.get("cursor")) cursor_status = EventsCursorStatus(obj.get("cursorStatus")) events = from_list(SessionEvent.from_dict, obj.get("events")) has_more = from_bool(obj.get("hasMore")) return EventsReadResult(cursor, cursor_status, events, has_more) def to_dict(self) -> dict: result: dict = {} result["cursor"] = from_str(self.cursor) result["cursorStatus"] = to_enum(EventsCursorStatus, self.cursor_status) result["events"] = from_list(lambda x: to_class(SessionEvent, x), self.events) result["hasMore"] = from_bool(self.has_more) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Extension: """Schema for the `Extension` type.""" id: str """Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper', 'plugin:my-plugin:my-ext') """ name: str """Extension name (directory name)""" source: ExtensionSource """Discovery source: project (.github/extensions/), user (~/.copilot/extensions/), plugin (installed plugin), or session (session-state//extensions/) """ status: ExtensionStatus """Current status: running, disabled, failed, or starting""" pid: int | None = None """Process ID if the extension is running""" @staticmethod def from_dict(obj: Any) -> 'Extension': assert isinstance(obj, dict) id = from_str(obj.get("id")) name = from_str(obj.get("name")) source = ExtensionSource(obj.get("source")) status = ExtensionStatus(obj.get("status")) pid = from_union([from_int, from_none], obj.get("pid")) return Extension(id, name, source, status, pid) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) result["name"] = from_str(self.name) result["source"] = to_enum(ExtensionSource, self.source) result["status"] = to_enum(ExtensionStatus, self.status) if self.pid is not None: result["pid"] = from_union([from_int, from_none], self.pid) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionContextPushInput: """Slim input shape for extension_context attachments; identity fields are runtime-derived.""" payload: Any """Caller-supplied JSON payload (required, may be null but not undefined)""" title: str """Human-readable composer pill label""" type: ClassVar[str] = "extension_context" """Attachment type discriminator""" @staticmethod def from_dict(obj: Any) -> 'ExtensionContextPushInput': assert isinstance(obj, dict) payload = obj.get("payload") title = from_str(obj.get("title")) return ExtensionContextPushInput(payload, title) def to_dict(self) -> dict: result: dict = {} result["payload"] = self.payload result["title"] = from_str(self.title) result["type"] = self.type return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmBinaryResultsForLlm: """Binary result returned by a tool for the model""" data: str """Base64-encoded binary data""" mime_type: str """MIME type of the binary data""" type: ExternalToolTextResultForLlmBinaryResultsForLlmType """Binary result type discriminator. Use "image" for images and "resource" for other binary data. """ description: str | None = None """Human-readable description of the binary data""" metadata: dict[str, Any] | None = None """Optional metadata from the producing tool.""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmBinaryResultsForLlm': assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) type = ExternalToolTextResultForLlmBinaryResultsForLlmType(obj.get("type")) description = from_union([from_str, from_none], obj.get("description")) metadata = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("metadata")) return ExternalToolTextResultForLlmBinaryResultsForLlm(data, mime_type, type, description, metadata) def to_dict(self) -> dict: result: dict = {} result["data"] = from_str(self.data) result["mimeType"] = from_str(self.mime_type) result["type"] = to_enum(ExternalToolTextResultForLlmBinaryResultsForLlmType, self.type) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.metadata is not None: result["metadata"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.metadata) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResourceLinkIcon: """Icon image for a resource""" src: str """URL or path to the icon image""" mime_type: str | None = None """MIME type of the icon image""" sizes: list[str] | None = None """Available icon sizes (e.g., ['16x16', '32x32'])""" theme: Theme | None = None """Theme variant this icon is intended for""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResourceLinkIcon': assert isinstance(obj, dict) src = from_str(obj.get("src")) mime_type = from_union([from_str, from_none], obj.get("mimeType")) sizes = from_union([lambda x: from_list(from_str, x), from_none], obj.get("sizes")) theme = from_union([Theme, from_none], obj.get("theme")) return ExternalToolTextResultForLlmContentResourceLinkIcon(src, mime_type, sizes, theme) def to_dict(self) -> dict: result: dict = {} result["src"] = from_str(self.src) if self.mime_type is not None: result["mimeType"] = from_union([from_str, from_none], self.mime_type) if self.sizes is not None: result["sizes"] = from_union([lambda x: from_list(from_str, x), from_none], self.sizes) if self.theme is not None: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) return result ExternalToolTextResultForLlmContentResourceDetails = EmbeddedTextResourceContents | EmbeddedBlobResourceContents # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentAudio: """Audio content block with base64-encoded data""" data: str """Base64-encoded audio data""" mime_type: str """MIME type of the audio (e.g., audio/wav, audio/mpeg)""" type: ClassVar[str] = "audio" """Content block type discriminator""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentAudio': assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) return ExternalToolTextResultForLlmContentAudio(data, mime_type) def to_dict(self) -> dict: result: dict = {} result["data"] = from_str(self.data) result["mimeType"] = from_str(self.mime_type) result["type"] = self.type return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentImage: """Image content block with base64-encoded data""" data: str """Base64-encoded image data""" mime_type: str """MIME type of the image (e.g., image/png, image/jpeg)""" type: ClassVar[str] = "image" """Content block type discriminator""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentImage': assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) return ExternalToolTextResultForLlmContentImage(data, mime_type) def to_dict(self) -> dict: result: dict = {} result["data"] = from_str(self.data) result["mimeType"] = from_str(self.mime_type) result["type"] = self.type return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResource: """Embedded resource content block with inline text or binary data""" resource: ExternalToolTextResultForLlmContentResourceDetails """The embedded resource contents, either text or base64-encoded binary""" type: ClassVar[str] = "resource" """Content block type discriminator""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResource': assert isinstance(obj, dict) resource = (lambda x: from_union([EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x))(obj.get("resource")) return ExternalToolTextResultForLlmContentResource(resource) def to_dict(self) -> dict: result: dict = {} result["resource"] = from_union([lambda x: to_class(EmbeddedTextResourceContents, x), lambda x: to_class(EmbeddedBlobResourceContents, x)], self.resource) result["type"] = self.type return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentShellExit: """Shell command exit metadata with optional output preview""" exit_code: int """Exit code from the completed shell command""" shell_id: str """Shell id, as assigned by Copilot runtime""" type: ClassVar[str] = "shell_exit" """Content block type discriminator""" cwd: str | None = None """Working directory where the shell command was executed""" output_preview: str | None = None """Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output. """ output_truncated: bool | None = None """Whether outputPreview is known to be incomplete or truncated""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentShellExit': assert isinstance(obj, dict) exit_code = from_int(obj.get("exitCode")) shell_id = from_str(obj.get("shellId")) cwd = from_union([from_str, from_none], obj.get("cwd")) output_preview = from_union([from_str, from_none], obj.get("outputPreview")) output_truncated = from_union([from_bool, from_none], obj.get("outputTruncated")) return ExternalToolTextResultForLlmContentShellExit(exit_code, shell_id, cwd, output_preview, output_truncated) def to_dict(self) -> dict: result: dict = {} result["exitCode"] = from_int(self.exit_code) result["shellId"] = from_str(self.shell_id) result["type"] = self.type if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.output_preview is not None: result["outputPreview"] = from_union([from_str, from_none], self.output_preview) if self.output_truncated is not None: result["outputTruncated"] = from_union([from_bool, from_none], self.output_truncated) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentTerminal: """Terminal/shell output content block with optional exit code and working directory""" text: str """Terminal/shell output text""" type: ClassVar[str] = "terminal" """Content block type discriminator""" cwd: str | None = None """Working directory where the command was executed""" exit_code: int | None = None """Process exit code, if the command has completed""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentTerminal': assert isinstance(obj, dict) text = from_str(obj.get("text")) cwd = from_union([from_str, from_none], obj.get("cwd")) exit_code = from_union([from_int, from_none], obj.get("exitCode")) return ExternalToolTextResultForLlmContentTerminal(text, cwd, exit_code) def to_dict(self) -> dict: result: dict = {} result["text"] = from_str(self.text) result["type"] = self.type if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.exit_code is not None: result["exitCode"] = from_union([from_int, from_none], self.exit_code) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentText: """Plain text content block""" text: str """The text content""" type: ClassVar[str] = "text" """Content block type discriminator""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentText': assert isinstance(obj, dict) text = from_str(obj.get("text")) return ExternalToolTextResultForLlmContentText(text) def to_dict(self) -> dict: result: dict = {} result["text"] = from_str(self.text) result["type"] = self.type return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandTextResult: """Schema for the `SlashCommandTextResult` type.""" kind: ClassVar[str] = "text" """Text result discriminator""" text: str """Text output for the client to render""" markdown: bool | None = None """Whether text contains Markdown""" preserve_ansi: bool | None = None """Whether ANSI sequences should be preserved""" runtime_settings_changed: bool | None = None """True when the invocation mutated user runtime settings; consumers caching settings should refresh """ @staticmethod def from_dict(obj: Any) -> 'SlashCommandTextResult': assert isinstance(obj, dict) text = from_str(obj.get("text")) markdown = from_union([from_bool, from_none], obj.get("markdown")) preserve_ansi = from_union([from_bool, from_none], obj.get("preserveAnsi")) runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) return SlashCommandTextResult(text, markdown, preserve_ansi, runtime_settings_changed) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["text"] = from_str(self.text) if self.markdown is not None: result["markdown"] = from_union([from_bool, from_none], self.markdown) if self.preserve_ansi is not None: result["preserveAnsi"] = from_union([from_bool, from_none], self.preserve_ansi) if self.runtime_settings_changed is not None: result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactResult: """Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. """ messages_removed: int """Number of messages removed during compaction""" success: bool """Whether compaction completed successfully""" tokens_removed: int """Number of tokens freed by compaction""" context_window: HistoryCompactContextWindow | None = None """Post-compaction context window usage breakdown""" summary_content: str | None = None """Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). """ @staticmethod def from_dict(obj: Any) -> 'HistoryCompactResult': assert isinstance(obj, dict) messages_removed = from_int(obj.get("messagesRemoved")) success = from_bool(obj.get("success")) tokens_removed = from_int(obj.get("tokensRemoved")) context_window = from_union([HistoryCompactContextWindow.from_dict, from_none], obj.get("contextWindow")) summary_content = from_union([from_str, from_none], obj.get("summaryContent")) return HistoryCompactResult(messages_removed, success, tokens_removed, context_window, summary_content) def to_dict(self) -> dict: result: dict = {} result["messagesRemoved"] = from_int(self.messages_removed) result["success"] = from_bool(self.success) result["tokensRemoved"] = from_int(self.tokens_removed) if self.context_window is not None: result["contextWindow"] = from_union([lambda x: to_class(HistoryCompactContextWindow, x), from_none], self.context_window) if self.summary_content is not None: result["summaryContent"] = from_union([from_str, from_none], self.summary_content) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceGitHub: """Schema for the `InstalledPluginSourceGitHub` type.""" repo: str source: FluffySource """Constant value. Always "github".""" path: str | None = None ref: str | None = None @staticmethod def from_dict(obj: Any) -> 'InstalledPluginSourceGitHub': assert isinstance(obj, dict) repo = from_str(obj.get("repo")) source = FluffySource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) return InstalledPluginSourceGitHub(repo, source, path, ref) def to_dict(self) -> dict: result: dict = {} result["repo"] = from_str(self.repo) result["source"] = to_enum(FluffySource, self.source) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: result["ref"] = from_union([from_str, from_none], self.ref) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceGitHub: """Schema for the `SessionInstalledPluginSourceGitHub` type.""" repo: str source: FluffySource """Constant value. Always "github".""" path: str | None = None ref: str | None = None @staticmethod def from_dict(obj: Any) -> 'SessionInstalledPluginSourceGitHub': assert isinstance(obj, dict) repo = from_str(obj.get("repo")) source = FluffySource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) return SessionInstalledPluginSourceGitHub(repo, source, path, ref) def to_dict(self) -> dict: result: dict = {} result["repo"] = from_str(self.repo) result["source"] = to_enum(FluffySource, self.source) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: result["ref"] = from_union([from_str, from_none], self.ref) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceLocal: """Schema for the `InstalledPluginSourceLocal` type.""" path: str source: TentacledSource """Constant value. Always "local".""" @staticmethod def from_dict(obj: Any) -> 'InstalledPluginSourceLocal': assert isinstance(obj, dict) path = from_str(obj.get("path")) source = TentacledSource(obj.get("source")) return InstalledPluginSourceLocal(path, source) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["source"] = to_enum(TentacledSource, self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceLocal: """Schema for the `SessionInstalledPluginSourceLocal` type.""" path: str source: TentacledSource """Constant value. Always "local".""" @staticmethod def from_dict(obj: Any) -> 'SessionInstalledPluginSourceLocal': assert isinstance(obj, dict) path = from_str(obj.get("path")) source = TentacledSource(obj.get("source")) return SessionInstalledPluginSourceLocal(path, source) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["source"] = to_enum(TentacledSource, self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceURL: """Schema for the `InstalledPluginSourceUrl` type.""" source: StickySource """Constant value. Always "url".""" url: str path: str | None = None ref: str | None = None @staticmethod def from_dict(obj: Any) -> 'InstalledPluginSourceURL': assert isinstance(obj, dict) source = StickySource(obj.get("source")) url = from_str(obj.get("url")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) return InstalledPluginSourceURL(source, url, path, ref) def to_dict(self) -> dict: result: dict = {} result["source"] = to_enum(StickySource, self.source) result["url"] = from_str(self.url) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: result["ref"] = from_union([from_str, from_none], self.ref) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceURL: """Schema for the `SessionInstalledPluginSourceUrl` type.""" source: StickySource """Constant value. Always "url".""" url: str path: str | None = None ref: str | None = None @staticmethod def from_dict(obj: Any) -> 'SessionInstalledPluginSourceURL': assert isinstance(obj, dict) source = StickySource(obj.get("source")) url = from_str(obj.get("url")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) return SessionInstalledPluginSourceURL(source, url, path, ref) def to_dict(self) -> dict: result: dict = {} result["source"] = to_enum(StickySource, self.source) result["url"] = from_str(self.url) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: result["ref"] = from_union([from_str, from_none], self.ref) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirWithTypesEntry: """Schema for the `SessionFsReaddirWithTypesEntry` type.""" name: str """Entry name""" type: InstructionDiscoveryPathKind """Entry type""" @staticmethod def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesEntry': assert isinstance(obj, dict) name = from_str(obj.get("name")) type = InstructionDiscoveryPathKind(obj.get("type")) return SessionFSReaddirWithTypesEntry(name, type) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["type"] = to_enum(InstructionDiscoveryPathKind, self.type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionDiscoveryPath: """Schema for the `InstructionDiscoveryPath` type.""" kind: InstructionDiscoveryPathKind """Whether the target is a single file or a directory of instruction files""" location: InstructionLocation """Which tier this target belongs to""" path: str """Absolute path of the file or directory (may not exist on disk yet)""" preferred_for_creation: bool """Whether this is the canonical target to create new instructions in its tier. At most one entry per tier is preferred. """ project_path: str | None = None """The input project path this target was derived from (only for repository targets)""" @staticmethod def from_dict(obj: Any) -> 'InstructionDiscoveryPath': assert isinstance(obj, dict) kind = InstructionDiscoveryPathKind(obj.get("kind")) location = InstructionLocation(obj.get("location")) path = from_str(obj.get("path")) preferred_for_creation = from_bool(obj.get("preferredForCreation")) project_path = from_union([from_str, from_none], obj.get("projectPath")) return InstructionDiscoveryPath(kind, location, path, preferred_for_creation, project_path) def to_dict(self) -> dict: result: dict = {} result["kind"] = to_enum(InstructionDiscoveryPathKind, self.kind) result["location"] = to_enum(InstructionLocation, self.location) result["path"] = from_str(self.path) result["preferredForCreation"] = from_bool(self.preferred_for_creation) if self.project_path is not None: result["projectPath"] = from_union([from_str, from_none], self.project_path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionSource: """Schema for the `InstructionSource` type.""" content: str """Raw content of the instruction file""" id: str """Unique identifier for this source (used for toggling)""" label: str """Human-readable label""" location: InstructionLocation """Where this source lives — used for UI grouping""" source_path: str """File path relative to repo or absolute for home""" type: InstructionSourceType """Category of instruction source — used for merge logic""" apply_to: list[str] | None = None """Glob pattern(s) from frontmatter — when set, this instruction applies only to matching files """ default_disabled: bool | None = None """When true, this source starts disabled and must be toggled on by the user""" description: str | None = None """Short description (body after frontmatter) for use in instruction tables""" project_path: str | None = None """The project path this source was discovered from. Only set by sessionless discovery for repository/working-directory sources, where it disambiguates same-named files (e.g. .github/copilot-instructions.md) across multiple workspace roots. The session-scoped getSources leaves it unset. """ @staticmethod def from_dict(obj: Any) -> 'InstructionSource': assert isinstance(obj, dict) content = from_str(obj.get("content")) id = from_str(obj.get("id")) label = from_str(obj.get("label")) location = InstructionLocation(obj.get("location")) source_path = from_str(obj.get("sourcePath")) type = InstructionSourceType(obj.get("type")) apply_to = from_union([lambda x: from_list(from_str, x), from_none], obj.get("applyTo")) default_disabled = from_union([from_bool, from_none], obj.get("defaultDisabled")) description = from_union([from_str, from_none], obj.get("description")) project_path = from_union([from_str, from_none], obj.get("projectPath")) return InstructionSource(content, id, label, location, source_path, type, apply_to, default_disabled, description, project_path) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) result["id"] = from_str(self.id) result["label"] = from_str(self.label) result["location"] = to_enum(InstructionLocation, self.location) result["sourcePath"] = from_str(self.source_path) result["type"] = to_enum(InstructionSourceType, self.type) if self.apply_to is not None: result["applyTo"] = from_union([lambda x: from_list(from_str, x), from_none], self.apply_to) if self.default_disabled is not None: result["defaultDisabled"] = from_union([from_bool, from_none], self.default_disabled) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.project_path is not None: result["projectPath"] = from_union([from_str, from_none], self.project_path) return result @dataclass class LlmInferenceHTTPRequestStartRequest: """The head of an outbound model-layer HTTP request.""" headers: dict[str, list[str]] method: str """HTTP method, e.g. GET, POST.""" request_id: str """Opaque runtime-minted id, unique per in-flight request. The SDK uses this to correlate httpRequestChunk frames and to address its httpResponseStart / httpResponseChunk replies back to the runtime. """ url: str """Absolute request URL.""" session_id: str | None = None """Id of the runtime session that triggered this request, when one is in scope. Absent for requests issued outside any session (e.g. startup model-catalog or capability resolution). This is a payload field — not a dispatch key — because the client-global API is registered process-wide rather than per session. """ transport: LlmInferenceHTTPRequestStartTransport | None = None """Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. """ @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPRequestStartRequest': assert isinstance(obj, dict) headers = from_dict(lambda x: from_list(from_str, x), obj.get("headers")) method = from_str(obj.get("method")) request_id = from_str(obj.get("requestId")) url = from_str(obj.get("url")) session_id = from_union([from_str, from_none], obj.get("sessionId")) transport = from_union([LlmInferenceHTTPRequestStartTransport, from_none], obj.get("transport")) return LlmInferenceHTTPRequestStartRequest(headers, method, request_id, url, session_id, transport) def to_dict(self) -> dict: result: dict = {} result["headers"] = from_dict(lambda x: from_list(from_str, x), self.headers) result["method"] = from_str(self.method) result["requestId"] = from_str(self.request_id) result["url"] = from_str(self.url) if self.session_id is not None: result["sessionId"] = from_union([from_str, from_none], self.session_id) if self.transport is not None: result["transport"] = from_union([lambda x: to_enum(LlmInferenceHTTPRequestStartTransport, x), from_none], self.transport) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LlmInferenceHTTPResponseChunkRequest: """A response body chunk or terminal error.""" data: str """Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty (e.g. when the response body is empty: send a single chunk with empty data and end=true). """ request_id: str """Matches the requestId from the originating httpRequestStart frame.""" binary: bool | None = None """When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text.""" end: bool | None = None """When true, this is the final body chunk for the response. The runtime treats the response body as complete after receiving an end-marked chunk. """ error: LlmInferenceHTTPResponseChunkError | None = None """Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. """ @staticmethod def from_dict(obj: Any) -> 'LlmInferenceHTTPResponseChunkRequest': assert isinstance(obj, dict) data = from_str(obj.get("data")) request_id = from_str(obj.get("requestId")) binary = from_union([from_bool, from_none], obj.get("binary")) end = from_union([from_bool, from_none], obj.get("end")) error = from_union([LlmInferenceHTTPResponseChunkError.from_dict, from_none], obj.get("error")) return LlmInferenceHTTPResponseChunkRequest(data, request_id, binary, end, error) def to_dict(self) -> dict: result: dict = {} result["data"] = from_str(self.data) result["requestId"] = from_str(self.request_id) if self.binary is not None: result["binary"] = from_union([from_bool, from_none], self.binary) if self.end is not None: result["end"] = from_union([from_bool, from_none], self.end) if self.error is not None: result["error"] = from_union([lambda x: to_class(LlmInferenceHTTPResponseChunkError, x), from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionContext: """Pre-resolved working-directory context for session startup. Most recent working directory context. Working-directory context used to choose the most relevant session. Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. """ cwd: str """Most recent working directory for this session""" branch: str | None = None """Active git branch""" git_root: str | None = None """Git repository root, if the cwd was inside a git repo""" host_type: HostType | None = None """Repository host type""" repository: str | None = None """Repository slug in `owner/name` form, when known""" @staticmethod def from_dict(obj: Any) -> 'SessionContext': assert isinstance(obj, dict) cwd = from_str(obj.get("cwd")) branch = from_union([from_str, from_none], obj.get("branch")) git_root = from_union([from_str, from_none], obj.get("gitRoot")) host_type = from_union([HostType, from_none], obj.get("hostType")) repository = from_union([from_str, from_none], obj.get("repository")) return SessionContext(cwd, branch, git_root, host_type, repository) def to_dict(self) -> dict: result: dict = {} result["cwd"] = from_str(self.cwd) if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) if self.git_root is not None: result["gitRoot"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: result["hostType"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionWorkingDirectoryContext: """Updated working directory and git context. Emitted as the new payload of `session.context_changed`. """ cwd: str """Current working directory path""" base_commit: str | None = None """Merge-base commit SHA (fork point from the remote default branch)""" branch: str | None = None """Current git branch name""" git_root: str | None = None """Root directory of the git repository, resolved via git rev-parse""" head_commit: str | None = None """Head commit of the current git branch""" host_type: HostType | None = None """Hosting platform type of the repository""" repository: str | None = None """Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps) """ repository_host: str | None = None """Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com")""" @staticmethod def from_dict(obj: Any) -> 'SessionWorkingDirectoryContext': assert isinstance(obj, dict) cwd = from_str(obj.get("cwd")) base_commit = from_union([from_str, from_none], obj.get("baseCommit")) branch = from_union([from_str, from_none], obj.get("branch")) git_root = from_union([from_str, from_none], obj.get("gitRoot")) head_commit = from_union([from_str, from_none], obj.get("headCommit")) host_type = from_union([HostType, from_none], obj.get("hostType")) repository = from_union([from_str, from_none], obj.get("repository")) repository_host = from_union([from_str, from_none], obj.get("repositoryHost")) return SessionWorkingDirectoryContext(cwd, base_commit, branch, git_root, head_commit, host_type, repository, repository_host) def to_dict(self) -> dict: result: dict = {} result["cwd"] = from_str(self.cwd) if self.base_commit is not None: result["baseCommit"] = from_union([from_str, from_none], self.base_commit) if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) if self.git_root is not None: result["gitRoot"] = from_union([from_str, from_none], self.git_root) if self.head_commit is not None: result["headCommit"] = from_union([from_str, from_none], self.head_commit) if self.host_type is not None: result["hostType"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) if self.repository_host is not None: result["repositoryHost"] = from_union([from_str, from_none], self.repository_host) return result @dataclass class Workspace: id: str branch: str | None = None chronicle_sync_dismissed: bool | None = None client_name: str | None = None created_at: datetime | None = None cwd: str | None = None git_root: str | None = None host_type: HostType | None = None """Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration.""" mc_last_event_id: str | None = None mc_session_id: str | None = None mc_task_id: str | None = None name: str | None = None remote_steerable: bool | None = None repository: str | None = None summary_count: int | None = None updated_at: datetime | None = None user_named: bool | None = None @staticmethod def from_dict(obj: Any) -> 'Workspace': assert isinstance(obj, dict) id = from_str(obj.get("id")) branch = from_union([from_str, from_none], obj.get("branch")) chronicle_sync_dismissed = from_union([from_bool, from_none], obj.get("chronicle_sync_dismissed")) client_name = from_union([from_str, from_none], obj.get("client_name")) created_at = from_union([from_datetime, from_none], obj.get("created_at")) cwd = from_union([from_str, from_none], obj.get("cwd")) git_root = from_union([from_str, from_none], obj.get("git_root")) host_type = from_union([HostType, from_none], obj.get("host_type")) mc_last_event_id = from_union([from_str, from_none], obj.get("mc_last_event_id")) mc_session_id = from_union([from_str, from_none], obj.get("mc_session_id")) mc_task_id = from_union([from_str, from_none], obj.get("mc_task_id")) name = from_union([from_str, from_none], obj.get("name")) remote_steerable = from_union([from_bool, from_none], obj.get("remote_steerable")) repository = from_union([from_str, from_none], obj.get("repository")) summary_count = from_union([from_int, from_none], obj.get("summary_count")) updated_at = from_union([from_datetime, from_none], obj.get("updated_at")) user_named = from_union([from_bool, from_none], obj.get("user_named")) return Workspace(id, branch, chronicle_sync_dismissed, client_name, created_at, cwd, git_root, host_type, mc_last_event_id, mc_session_id, mc_task_id, name, remote_steerable, repository, summary_count, updated_at, user_named) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) if self.chronicle_sync_dismissed is not None: result["chronicle_sync_dismissed"] = from_union([from_bool, from_none], self.chronicle_sync_dismissed) if self.client_name is not None: result["client_name"] = from_union([from_str, from_none], self.client_name) if self.created_at is not None: result["created_at"] = from_union([lambda x: x.isoformat(), from_none], self.created_at) if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.git_root is not None: result["git_root"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: result["host_type"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) if self.mc_last_event_id is not None: result["mc_last_event_id"] = from_union([from_str, from_none], self.mc_last_event_id) if self.mc_session_id is not None: result["mc_session_id"] = from_union([from_str, from_none], self.mc_session_id) if self.mc_task_id is not None: result["mc_task_id"] = from_union([from_str, from_none], self.mc_task_id) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.remote_steerable is not None: result["remote_steerable"] = from_union([from_bool, from_none], self.remote_steerable) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) if self.summary_count is not None: result["summary_count"] = from_union([from_int, from_none], self.summary_count) if self.updated_at is not None: result["updated_at"] = from_union([lambda x: x.isoformat(), from_none], self.updated_at) if self.user_named is not None: result["user_named"] = from_union([from_bool, from_none], self.user_named) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LogRequest: """Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. """ message: str """Human-readable message""" ephemeral: bool | None = None """When true, the message is transient and not persisted to the session event log on disk""" level: SessionLogLevel | None = None """Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". """ tip: str | None = None """Optional actionable tip displayed alongside the message. Only honored on `level: "info"`.""" type: str | None = None """Domain category for this log entry (e.g., "mcp", "subscription", "policy", "model"). Maps to `infoType`/`warningType`/`errorType` on the emitted event. Defaults to "notification". """ url: str | None = None """Optional URL the user can open in their browser for more details""" @staticmethod def from_dict(obj: Any) -> 'LogRequest': assert isinstance(obj, dict) message = from_str(obj.get("message")) ephemeral = from_union([from_bool, from_none], obj.get("ephemeral")) level = from_union([SessionLogLevel, from_none], obj.get("level")) tip = from_union([from_str, from_none], obj.get("tip")) type = from_union([from_str, from_none], obj.get("type")) url = from_union([from_str, from_none], obj.get("url")) return LogRequest(message, ephemeral, level, tip, type, url) def to_dict(self) -> dict: result: dict = {} result["message"] = from_str(self.message) if self.ephemeral is not None: result["ephemeral"] = from_union([from_bool, from_none], self.ephemeral) if self.level is not None: result["level"] = from_union([lambda x: to_enum(SessionLogLevel, x), from_none], self.level) if self.tip is not None: result["tip"] = from_union([from_str, from_none], self.tip) if self.type is not None: result["type"] = from_union([from_str, from_none], self.type) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MarketplaceListResult: """All registered marketplaces, including built-in defaults.""" marketplaces: list[MarketplaceInfo] """Registered marketplaces""" @staticmethod def from_dict(obj: Any) -> 'MarketplaceListResult': assert isinstance(obj, dict) marketplaces = from_list(MarketplaceInfo.from_dict, obj.get("marketplaces")) return MarketplaceListResult(marketplaces) def to_dict(self) -> dict: result: dict = {} result["marketplaces"] = from_list(lambda x: to_class(MarketplaceInfo, x), self.marketplaces) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MarketplaceRefreshResult: """Result of refreshing one or more marketplace catalogs.""" results: list[MarketplaceRefreshEntry] """Per-marketplace refresh results in deterministic order.""" @staticmethod def from_dict(obj: Any) -> 'MarketplaceRefreshResult': assert isinstance(obj, dict) results = from_list(MarketplaceRefreshEntry.from_dict, obj.get("results")) return MarketplaceRefreshResult(results) def to_dict(self) -> dict: result: dict = {} result["results"] = from_list(lambda x: to_class(MarketplaceRefreshEntry, x), self.results) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseResult: """Diagnostic snapshot of MCP Apps wiring for the named server.""" capability: MCPAppsDiagnoseCapability """Capability negotiation snapshot""" server: MCPAppsDiagnoseServer """What the server returned for this session""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsDiagnoseResult': assert isinstance(obj, dict) capability = MCPAppsDiagnoseCapability.from_dict(obj.get("capability")) server = MCPAppsDiagnoseServer.from_dict(obj.get("server")) return MCPAppsDiagnoseResult(capability, server) def to_dict(self) -> dict: result: dict = {} result["capability"] = to_class(MCPAppsDiagnoseCapability, self.capability) result["server"] = to_class(MCPAppsDiagnoseServer, self.server) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsHostContextDetails: """Current host context""" available_display_modes: list[MCPAppsDisplayMode] | None = None """Display modes the host supports""" display_mode: MCPAppsDisplayMode | None = None """Current display mode (SEP-1865)""" locale: str | None = None """BCP-47 locale, e.g. 'en-US'""" platform: MCPAppsHostContextDetailsPlatform | None = None """Platform type for responsive design""" theme: Theme | None = None """UI theme preference per SEP-1865""" time_zone: str | None = None """IANA timezone, e.g. 'America/New_York'""" user_agent: str | None = None """Host application identifier""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsHostContextDetails': assert isinstance(obj, dict) available_display_modes = from_union([lambda x: from_list(MCPAppsDisplayMode, x), from_none], obj.get("availableDisplayModes")) display_mode = from_union([MCPAppsDisplayMode, from_none], obj.get("displayMode")) locale = from_union([from_str, from_none], obj.get("locale")) platform = from_union([MCPAppsHostContextDetailsPlatform, from_none], obj.get("platform")) theme = from_union([Theme, from_none], obj.get("theme")) time_zone = from_union([from_str, from_none], obj.get("timeZone")) user_agent = from_union([from_str, from_none], obj.get("userAgent")) return MCPAppsHostContextDetails(available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent) def to_dict(self) -> dict: result: dict = {} if self.available_display_modes is not None: result["availableDisplayModes"] = from_union([lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], self.available_display_modes) if self.display_mode is not None: result["displayMode"] = from_union([lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode) if self.locale is not None: result["locale"] = from_union([from_str, from_none], self.locale) if self.platform is not None: result["platform"] = from_union([lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform) if self.theme is not None: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) if self.time_zone is not None: result["timeZone"] = from_union([from_str, from_none], self.time_zone) if self.user_agent is not None: result["userAgent"] = from_union([from_str, from_none], self.user_agent) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsSetHostContextDetails: """Host context advertised to MCP App guests""" available_display_modes: list[MCPAppsDisplayMode] | None = None """Display modes the host supports""" display_mode: MCPAppsDisplayMode | None = None """Current display mode (SEP-1865)""" locale: str | None = None """BCP-47 locale, e.g. 'en-US'""" platform: MCPAppsHostContextDetailsPlatform | None = None """Platform type for responsive design""" theme: Theme | None = None """UI theme preference per SEP-1865""" time_zone: str | None = None """IANA timezone, e.g. 'America/New_York'""" user_agent: str | None = None """Host application identifier""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsSetHostContextDetails': assert isinstance(obj, dict) available_display_modes = from_union([lambda x: from_list(MCPAppsDisplayMode, x), from_none], obj.get("availableDisplayModes")) display_mode = from_union([MCPAppsDisplayMode, from_none], obj.get("displayMode")) locale = from_union([from_str, from_none], obj.get("locale")) platform = from_union([MCPAppsHostContextDetailsPlatform, from_none], obj.get("platform")) theme = from_union([Theme, from_none], obj.get("theme")) time_zone = from_union([from_str, from_none], obj.get("timeZone")) user_agent = from_union([from_str, from_none], obj.get("userAgent")) return MCPAppsSetHostContextDetails(available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent) def to_dict(self) -> dict: result: dict = {} if self.available_display_modes is not None: result["availableDisplayModes"] = from_union([lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], self.available_display_modes) if self.display_mode is not None: result["displayMode"] = from_union([lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode) if self.locale is not None: result["locale"] = from_union([from_str, from_none], self.locale) if self.platform is not None: result["platform"] = from_union([lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform) if self.theme is not None: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) if self.time_zone is not None: result["timeZone"] = from_union([from_str, from_none], self.time_zone) if self.user_agent is not None: result["userAgent"] = from_union([from_str, from_none], self.user_agent) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsReadResourceResult: """Resource contents returned by the MCP server.""" contents: list[MCPAppsResourceContent] """Resource contents returned by the server""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsReadResourceResult': assert isinstance(obj, dict) contents = from_list(MCPAppsResourceContent.from_dict, obj.get("contents")) return MCPAppsReadResourceResult(contents) def to_dict(self) -> dict: result: dict = {} result["contents"] = from_list(lambda x: to_class(MCPAppsResourceContent, x), self.contents) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerConfigStdio: """Stdio MCP server configuration launched as a child process.""" command: str """Executable command used to start the Stdio MCP server process.""" args: list[str] | None = None """Command-line arguments passed to the Stdio MCP server process.""" auth: bool | MCPServerAuthConfigRedirectPort | None = None """Set to `true` to use defaults, or provide an object with additional auth or OIDC settings.""" cwd: str | None = None """Working directory for the Stdio MCP server process.""" defer_tools: MCPServerConfigDeferTools | None = None """Controls if tools provided by this server can be loaded on demand via tool search (auto) or always included in the initial tool list (never) """ env: dict[str, str] | None = None """Environment variables to pass to the Stdio MCP server process.""" filter_mapping: dict[str, ContentFilterMode] | ContentFilterMode | None = None """Content filtering mode to apply to all tools, or a map of tool name to content filtering mode. """ is_default_server: bool | None = None """Whether this server is a built-in fallback used when the user has not configured their own server. """ oidc: bool | MCPServerAuthConfigRedirectPort | None = None """Set to `true` to use defaults, or provide an object with additional auth or OIDC settings.""" timeout: int | None = None """Timeout in milliseconds for tool calls to this server.""" tools: list[str] | None = None """Tools to include. Defaults to all tools if not specified.""" @staticmethod def from_dict(obj: Any) -> 'MCPServerConfigStdio': assert isinstance(obj, dict) command = from_str(obj.get("command")) args = from_union([lambda x: from_list(from_str, x), from_none], obj.get("args")) auth = from_union([from_bool, MCPServerAuthConfigRedirectPort.from_dict, from_none], obj.get("auth")) cwd = from_union([from_str, from_none], obj.get("cwd")) defer_tools = from_union([MCPServerConfigDeferTools, from_none], obj.get("deferTools")) env = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("env")) filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) oidc = from_union([from_bool, MCPServerAuthConfigRedirectPort.from_dict, from_none], obj.get("oidc")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) return MCPServerConfigStdio(command, args, auth, cwd, defer_tools, env, filter_mapping, is_default_server, oidc, timeout, tools) def to_dict(self) -> dict: result: dict = {} result["command"] = from_str(self.command) if self.args is not None: result["args"] = from_union([lambda x: from_list(from_str, x), from_none], self.args) if self.auth is not None: result["auth"] = from_union([from_bool, lambda x: to_class(MCPServerAuthConfigRedirectPort, x), from_none], self.auth) if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.defer_tools is not None: result["deferTools"] = from_union([lambda x: to_enum(MCPServerConfigDeferTools, x), from_none], self.defer_tools) if self.env is not None: result["env"] = from_union([lambda x: from_dict(from_str, x), from_none], self.env) if self.filter_mapping is not None: result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.oidc is not None: result["oidc"] = from_union([from_bool, lambda x: to_class(MCPServerAuthConfigRedirectPort, x), from_none], self.oidc) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthLoginRequest: """Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection. """ server_name: str """Name of the remote MCP server to authenticate""" callback_success_message: str | None = None """Optional override for the body text shown on the OAuth loopback callback success page. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass surface-specific copy telling the user where to return. """ client_id: str | None = None """Optional OAuth client ID override for this login. When set, the runtime uses this pre-registered static client instead of dynamic client registration. """ client_name: str | None = None """Optional override for the OAuth client display name shown on the consent screen. Applies to newly registered dynamic clients only — existing registrations keep the name they were created with. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass their own surface-specific label so the consent screen matches the product the user sees. """ client_secret: str | None = None """Optional OAuth client secret override for this login. The runtime treats this as an ephemeral host-owned secret, uses it for this authentication attempt and does not persist it. """ force_reauth: bool | None = None """When true, clears any cached OAuth token for the server and runs a full new authorization. Use when the user explicitly wants to switch accounts or believes their session is stuck. """ grant_type: MCPGrantType | None = None """Optional OAuth grant type override for this login. Defaults to the server configuration, or authorization_code when no grant type is specified. """ public_client: bool | None = None """Optional override indicating whether the static OAuth client is public. When false, the runtime treats it as confidential and uses the per-login clientSecret if provided, otherwise retrieving the client secret from the MCP OAuth secret store. """ @staticmethod def from_dict(obj: Any) -> 'MCPOauthLoginRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) callback_success_message = from_union([from_str, from_none], obj.get("callbackSuccessMessage")) client_id = from_union([from_str, from_none], obj.get("clientId")) client_name = from_union([from_str, from_none], obj.get("clientName")) client_secret = from_union([from_str, from_none], obj.get("clientSecret")) force_reauth = from_union([from_bool, from_none], obj.get("forceReauth")) grant_type = from_union([MCPGrantType, from_none], obj.get("grantType")) public_client = from_union([from_bool, from_none], obj.get("publicClient")) return MCPOauthLoginRequest(server_name, callback_success_message, client_id, client_name, client_secret, force_reauth, grant_type, public_client) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) if self.callback_success_message is not None: result["callbackSuccessMessage"] = from_union([from_str, from_none], self.callback_success_message) if self.client_id is not None: result["clientId"] = from_union([from_str, from_none], self.client_id) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.client_secret is not None: result["clientSecret"] = from_union([from_str, from_none], self.client_secret) if self.force_reauth is not None: result["forceReauth"] = from_union([from_bool, from_none], self.force_reauth) if self.grant_type is not None: result["grantType"] = from_union([lambda x: to_enum(MCPGrantType, x), from_none], self.grant_type) if self.public_client is not None: result["publicClient"] = from_union([from_bool, from_none], self.public_client) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerConfig: """MCP server configuration (stdio process or remote HTTP/SSE) Stdio MCP server configuration launched as a child process. Remote MCP server configuration accessed over HTTP or SSE. """ args: list[str] | None = None """Command-line arguments passed to the Stdio MCP server process.""" auth: bool | MCPServerAuthConfigRedirectPort | None = None """Set to `true` to use defaults, or provide an object with additional auth or OIDC settings.""" command: str | None = None """Executable command used to start the Stdio MCP server process.""" cwd: str | None = None """Working directory for the Stdio MCP server process.""" defer_tools: MCPServerConfigDeferTools | None = None """Controls if tools provided by this server can be loaded on demand via tool search (auto) or always included in the initial tool list (never) """ env: dict[str, str] | None = None """Environment variables to pass to the Stdio MCP server process.""" filter_mapping: dict[str, ContentFilterMode] | ContentFilterMode | None = None """Content filtering mode to apply to all tools, or a map of tool name to content filtering mode. """ is_default_server: bool | None = None """Whether this server is a built-in fallback used when the user has not configured their own server. """ oidc: bool | MCPServerAuthConfigRedirectPort | None = None """Set to `true` to use defaults, or provide an object with additional auth or OIDC settings.""" timeout: int | None = None """Timeout in milliseconds for tool calls to this server.""" tools: list[str] | None = None """Tools to include. Defaults to all tools if not specified.""" headers: dict[str, str] | None = None """HTTP headers to include in requests to the remote MCP server.""" oauth_client_id: str | None = None """OAuth client ID for a pre-registered remote MCP OAuth client.""" oauth_grant_type: MCPGrantType | None = None """OAuth grant type to use when authenticating to the remote MCP server.""" oauth_public_client: bool | None = None """Whether the configured OAuth client is public and does not require a client secret.""" type: MCPServerConfigHTTPType | None = None """Remote transport type. Defaults to "http" when omitted.""" url: str | None = None """URL of the remote MCP server endpoint.""" @staticmethod def from_dict(obj: Any) -> 'MCPServerConfig': assert isinstance(obj, dict) args = from_union([lambda x: from_list(from_str, x), from_none], obj.get("args")) auth = from_union([from_bool, MCPServerAuthConfigRedirectPort.from_dict, from_none], obj.get("auth")) command = from_union([from_str, from_none], obj.get("command")) cwd = from_union([from_str, from_none], obj.get("cwd")) defer_tools = from_union([MCPServerConfigDeferTools, from_none], obj.get("deferTools")) env = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("env")) filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) oidc = from_union([from_bool, MCPServerAuthConfigRedirectPort.from_dict, from_none], obj.get("oidc")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) oauth_client_id = from_union([from_str, from_none], obj.get("oauthClientId")) oauth_grant_type = from_union([MCPGrantType, from_none], obj.get("oauthGrantType")) oauth_public_client = from_union([from_bool, from_none], obj.get("oauthPublicClient")) type = from_union([MCPServerConfigHTTPType, from_none], obj.get("type")) url = from_union([from_str, from_none], obj.get("url")) return MCPServerConfig(args, auth, command, cwd, defer_tools, env, filter_mapping, is_default_server, oidc, timeout, tools, headers, oauth_client_id, oauth_grant_type, oauth_public_client, type, url) def to_dict(self) -> dict: result: dict = {} if self.args is not None: result["args"] = from_union([lambda x: from_list(from_str, x), from_none], self.args) if self.auth is not None: result["auth"] = from_union([from_bool, lambda x: to_class(MCPServerAuthConfigRedirectPort, x), from_none], self.auth) if self.command is not None: result["command"] = from_union([from_str, from_none], self.command) if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.defer_tools is not None: result["deferTools"] = from_union([lambda x: to_enum(MCPServerConfigDeferTools, x), from_none], self.defer_tools) if self.env is not None: result["env"] = from_union([lambda x: from_dict(from_str, x), from_none], self.env) if self.filter_mapping is not None: result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.oidc is not None: result["oidc"] = from_union([from_bool, lambda x: to_class(MCPServerAuthConfigRedirectPort, x), from_none], self.oidc) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.headers is not None: result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) if self.oauth_client_id is not None: result["oauthClientId"] = from_union([from_str, from_none], self.oauth_client_id) if self.oauth_grant_type is not None: result["oauthGrantType"] = from_union([lambda x: to_enum(MCPGrantType, x), from_none], self.oauth_grant_type) if self.oauth_public_client is not None: result["oauthPublicClient"] = from_union([from_bool, from_none], self.oauth_public_client) if self.type is not None: result["type"] = from_union([lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerConfigHTTP: """Remote MCP server configuration accessed over HTTP or SSE.""" url: str """URL of the remote MCP server endpoint.""" auth: bool | MCPServerAuthConfigRedirectPort | None = None """Set to `true` to use defaults, or provide an object with additional auth or OIDC settings.""" defer_tools: MCPServerConfigDeferTools | None = None """Controls if tools provided by this server can be loaded on demand via tool search (auto) or always included in the initial tool list (never) """ filter_mapping: dict[str, ContentFilterMode] | ContentFilterMode | None = None """Content filtering mode to apply to all tools, or a map of tool name to content filtering mode. """ headers: dict[str, str] | None = None """HTTP headers to include in requests to the remote MCP server.""" is_default_server: bool | None = None """Whether this server is a built-in fallback used when the user has not configured their own server. """ oauth_client_id: str | None = None """OAuth client ID for a pre-registered remote MCP OAuth client.""" oauth_grant_type: MCPGrantType | None = None """OAuth grant type to use when authenticating to the remote MCP server.""" oauth_public_client: bool | None = None """Whether the configured OAuth client is public and does not require a client secret.""" oidc: bool | MCPServerAuthConfigRedirectPort | None = None """Set to `true` to use defaults, or provide an object with additional auth or OIDC settings.""" timeout: int | None = None """Timeout in milliseconds for tool calls to this server.""" tools: list[str] | None = None """Tools to include. Defaults to all tools if not specified.""" type: MCPServerConfigHTTPType | None = None """Remote transport type. Defaults to "http" when omitted.""" @staticmethod def from_dict(obj: Any) -> 'MCPServerConfigHTTP': assert isinstance(obj, dict) url = from_str(obj.get("url")) auth = from_union([from_bool, MCPServerAuthConfigRedirectPort.from_dict, from_none], obj.get("auth")) defer_tools = from_union([MCPServerConfigDeferTools, from_none], obj.get("deferTools")) filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) oauth_client_id = from_union([from_str, from_none], obj.get("oauthClientId")) oauth_grant_type = from_union([MCPGrantType, from_none], obj.get("oauthGrantType")) oauth_public_client = from_union([from_bool, from_none], obj.get("oauthPublicClient")) oidc = from_union([from_bool, MCPServerAuthConfigRedirectPort.from_dict, from_none], obj.get("oidc")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) type = from_union([MCPServerConfigHTTPType, from_none], obj.get("type")) return MCPServerConfigHTTP(url, auth, defer_tools, filter_mapping, headers, is_default_server, oauth_client_id, oauth_grant_type, oauth_public_client, oidc, timeout, tools, type) def to_dict(self) -> dict: result: dict = {} result["url"] = from_str(self.url) if self.auth is not None: result["auth"] = from_union([from_bool, lambda x: to_class(MCPServerAuthConfigRedirectPort, x), from_none], self.auth) if self.defer_tools is not None: result["deferTools"] = from_union([lambda x: to_enum(MCPServerConfigDeferTools, x), from_none], self.defer_tools) if self.filter_mapping is not None: result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.headers is not None: result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.oauth_client_id is not None: result["oauthClientId"] = from_union([from_str, from_none], self.oauth_client_id) if self.oauth_grant_type is not None: result["oauthGrantType"] = from_union([lambda x: to_enum(MCPGrantType, x), from_none], self.oauth_grant_type) if self.oauth_public_client is not None: result["oauthPublicClient"] = from_union([from_bool, from_none], self.oauth_public_client) if self.oidc is not None: result["oidc"] = from_union([from_bool, lambda x: to_class(MCPServerAuthConfigRedirectPort, x), from_none], self.oidc) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.type is not None: result["type"] = from_union([lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPStartServersResult: """MCP server startup filtering result.""" filtered_servers: list[MCPFilteredServer] """Servers filtered out before startup""" allowed_servers: list[MCPAllowedServer] | None = None """Non-default servers allowed by policy""" @staticmethod def from_dict(obj: Any) -> 'MCPStartServersResult': assert isinstance(obj, dict) filtered_servers = from_list(MCPFilteredServer.from_dict, obj.get("filteredServers")) allowed_servers = from_union([lambda x: from_list(MCPAllowedServer.from_dict, x), from_none], obj.get("allowedServers")) return MCPStartServersResult(filtered_servers, allowed_servers) def to_dict(self) -> dict: result: dict = {} result["filteredServers"] = from_list(lambda x: to_class(MCPFilteredServer, x), self.filtered_servers) if self.allowed_servers is not None: result["allowedServers"] = from_union([lambda x: from_list(lambda x: to_class(MCPAllowedServer, x), x), from_none], self.allowed_servers) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPHeadersHandlePendingHeadersRefreshRequest: """Host response: supply dynamic headers or decline this refresh.""" kind: MCPHeadersHandlePendingHeadersRefreshRequestKind headers: dict[str, str] | None = None """Headers to overlay onto the MCP request. Dynamic headers override static config headers but do not replace SDK-managed request headers. """ @staticmethod def from_dict(obj: Any) -> 'MCPHeadersHandlePendingHeadersRefreshRequest': assert isinstance(obj, dict) kind = MCPHeadersHandlePendingHeadersRefreshRequestKind(obj.get("kind")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) return MCPHeadersHandlePendingHeadersRefreshRequest(kind, headers) def to_dict(self) -> dict: result: dict = {} result["kind"] = to_enum(MCPHeadersHandlePendingHeadersRefreshRequestKind, self.kind) if self.headers is not None: result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPHostState: """Host-level state, omitted when no MCP host is initialized.""" clients: list[str] """Names of currently-connected MCP clients.""" disabled_servers: list[str] """Configured servers that are explicitly disabled.""" failed_servers: dict[str, MCPServerFailureInfo] """Map of server name to recorded connection failure.""" filtered_servers: list[str] """Configured servers filtered out by enterprise allowlist policy.""" mcp3_p_enabled: bool """Whether third-party MCP servers are policy-enabled for this session.""" needs_auth_servers: dict[str, MCPServerNeedsAuthInfo] """Map of server name to recorded pending-auth state.""" pending_connections: list[str] """Names of servers with in-flight connection attempts.""" @staticmethod def from_dict(obj: Any) -> 'MCPHostState': assert isinstance(obj, dict) clients = from_list(from_str, obj.get("clients")) disabled_servers = from_list(from_str, obj.get("disabledServers")) failed_servers = from_dict(MCPServerFailureInfo.from_dict, obj.get("failedServers")) filtered_servers = from_list(from_str, obj.get("filteredServers")) mcp3_p_enabled = from_bool(obj.get("mcp3pEnabled")) needs_auth_servers = from_dict(MCPServerNeedsAuthInfo.from_dict, obj.get("needsAuthServers")) pending_connections = from_list(from_str, obj.get("pendingConnections")) return MCPHostState(clients, disabled_servers, failed_servers, filtered_servers, mcp3_p_enabled, needs_auth_servers, pending_connections) def to_dict(self) -> dict: result: dict = {} result["clients"] = from_list(from_str, self.clients) result["disabledServers"] = from_list(from_str, self.disabled_servers) result["failedServers"] = from_dict(lambda x: to_class(MCPServerFailureInfo, x), self.failed_servers) result["filteredServers"] = from_list(from_str, self.filtered_servers) result["mcp3pEnabled"] = from_bool(self.mcp3_p_enabled) result["needsAuthServers"] = from_dict(lambda x: to_class(MCPServerNeedsAuthInfo, x), self.needs_auth_servers) result["pendingConnections"] = from_list(from_str, self.pending_connections) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthPendingRequestResponse: """Host response to the pending OAuth request.""" kind: MCPOauthPendingRequestResponseKind access_token: str | None = None """Access token acquired by the SDK host""" expires_in: int | None = None """Token lifetime in seconds, if known.""" token_type: str | None = None """OAuth token type. Defaults to Bearer when omitted.""" @staticmethod def from_dict(obj: Any) -> 'MCPOauthPendingRequestResponse': assert isinstance(obj, dict) kind = MCPOauthPendingRequestResponseKind(obj.get("kind")) access_token = from_union([from_str, from_none], obj.get("accessToken")) expires_in = from_union([from_int, from_none], obj.get("expiresIn")) token_type = from_union([from_str, from_none], obj.get("tokenType")) return MCPOauthPendingRequestResponse(kind, access_token, expires_in, token_type) def to_dict(self) -> dict: result: dict = {} result["kind"] = to_enum(MCPOauthPendingRequestResponseKind, self.kind) if self.access_token is not None: result["accessToken"] = from_union([from_str, from_none], self.access_token) if self.expires_in is not None: result["expiresIn"] = from_union([from_int, from_none], self.expires_in) if self.token_type is not None: result["tokenType"] = from_union([from_str, from_none], self.token_type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSamplingExecutionResult: """Outcome of an MCP sampling execution: success result, failure error, or cancellation.""" action: MCPSamplingExecutionAction """Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution. """ error: str | None = None """Error description, present when action='failure'.""" result: dict[str, Any] | None = None """MCP CreateMessageResult payload (with optional 'tools' extension), present when action='success'. Treated as opaque at the schema layer; consumers should construct/consume it per the MCP CreateMessageResult shape. """ @staticmethod def from_dict(obj: Any) -> 'MCPSamplingExecutionResult': assert isinstance(obj, dict) action = MCPSamplingExecutionAction(obj.get("action")) error = from_union([from_str, from_none], obj.get("error")) result = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("result")) return MCPSamplingExecutionResult(action, error, result) def to_dict(self) -> dict: result: dict = {} result["action"] = to_enum(MCPSamplingExecutionAction, self.action) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result is not None: result["result"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.result) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSetEnvValueModeParams: """Mode controlling how MCP server env values are resolved (`direct` or `indirect`).""" mode: MCPSetEnvValueModeDetails """How environment-variable values supplied to MCP servers are resolved. "direct" passes literal string values; "indirect" treats values as references (e.g. names of environment variables on the host) that the runtime resolves before launch. Defaults to the runtime's startup mode; clients that intentionally launch MCP servers with literal values (e.g. CLI prompt mode and ACP) set this to "direct". """ @staticmethod def from_dict(obj: Any) -> 'MCPSetEnvValueModeParams': assert isinstance(obj, dict) mode = MCPSetEnvValueModeDetails(obj.get("mode")) return MCPSetEnvValueModeParams(mode) def to_dict(self) -> dict: result: dict = {} result["mode"] = to_enum(MCPSetEnvValueModeDetails, self.mode) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSetEnvValueModeResult: """Env-value mode recorded on the session after the update.""" mode: MCPSetEnvValueModeDetails """Mode recorded on the session after the update""" @staticmethod def from_dict(obj: Any) -> 'MCPSetEnvValueModeResult': assert isinstance(obj, dict) mode = MCPSetEnvValueModeDetails(obj.get("mode")) return MCPSetEnvValueModeResult(mode) def to_dict(self) -> dict: result: dict = {} result["mode"] = to_enum(MCPSetEnvValueModeDetails, self.mode) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataContextInfoResult: """Token breakdown for the session's current context window, or null if uninitialized.""" context_info: SessionContextInfo | None = None """Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). """ @staticmethod def from_dict(obj: Any) -> 'MetadataContextInfoResult': assert isinstance(obj, dict) context_info = from_union([SessionContextInfo.from_dict, from_none], obj.get("contextInfo")) return MetadataContextInfoResult(context_info) def to_dict(self) -> dict: result: dict = {} if self.context_info is not None: result["contextInfo"] = from_union([lambda x: to_class(SessionContextInfo, x), from_none], self.context_info) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSnapshotRemoteMetadata: """Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. """ repository: MetadataSnapshotRemoteMetadataRepository """The repository the remote session targets.""" pull_request_number: int | None = None """The pull request number the remote session is associated with, if any.""" resource_id: str | None = None """The original resource identifier (task ID or PR node ID), preserved across event-replay reconstructions. Falls back to `sessionId` when absent. """ task_type: TaskType | None = None """Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. """ @staticmethod def from_dict(obj: Any) -> 'MetadataSnapshotRemoteMetadata': assert isinstance(obj, dict) repository = MetadataSnapshotRemoteMetadataRepository.from_dict(obj.get("repository")) pull_request_number = from_union([from_int, from_none], obj.get("pullRequestNumber")) resource_id = from_union([from_str, from_none], obj.get("resourceId")) task_type = from_union([TaskType, from_none], obj.get("taskType")) return MetadataSnapshotRemoteMetadata(repository, pull_request_number, resource_id, task_type) def to_dict(self) -> dict: result: dict = {} result["repository"] = to_class(MetadataSnapshotRemoteMetadataRepository, self.repository) if self.pull_request_number is not None: result["pullRequestNumber"] = from_union([from_int, from_none], self.pull_request_number) if self.resource_id is not None: result["resourceId"] = from_union([from_str, from_none], self.resource_id) if self.task_type is not None: result["taskType"] = from_union([lambda x: to_enum(TaskType, x), from_none], self.task_type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelBillingTokenPrices: """Token-level pricing information for this model""" batch_size: int | None = None """Number of tokens per standard billing batch""" cache_price: float | None = None """Use cacheReadPrice instead. AI Credits cost per billing batch of cached tokens""" cache_read_price: float | None = None """AI Credits cost per billing batch of cached (read) tokens""" cache_write_price: float | None = None """AI Credits cost per billing batch of cache-write (cache creation) tokens.""" context_max: int | None = None """Use maxPromptTokens instead. Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens. """ input_price: float | None = None """AI Credits cost per billing batch of input tokens""" long_context: ModelBillingTokenPricesLongContext | None = None """Long context tier pricing (available for models with extended context windows)""" max_prompt_tokens: int | None = None """Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens. """ output_price: float | None = None """AI Credits cost per billing batch of output tokens""" @staticmethod def from_dict(obj: Any) -> 'ModelBillingTokenPrices': assert isinstance(obj, dict) batch_size = from_union([from_int, from_none], obj.get("batchSize")) cache_price = from_union([from_float, from_none], obj.get("cachePrice")) cache_read_price = from_union([from_float, from_none], obj.get("cacheReadPrice")) cache_write_price = from_union([from_float, from_none], obj.get("cacheWritePrice")) context_max = from_union([from_int, from_none], obj.get("contextMax")) input_price = from_union([from_float, from_none], obj.get("inputPrice")) long_context = from_union([ModelBillingTokenPricesLongContext.from_dict, from_none], obj.get("longContext")) max_prompt_tokens = from_union([from_int, from_none], obj.get("maxPromptTokens")) output_price = from_union([from_float, from_none], obj.get("outputPrice")) return ModelBillingTokenPrices(batch_size, cache_price, cache_read_price, cache_write_price, context_max, input_price, long_context, max_prompt_tokens, output_price) def to_dict(self) -> dict: result: dict = {} if self.batch_size is not None: result["batchSize"] = from_union([from_int, from_none], self.batch_size) if self.cache_price is not None: result["cachePrice"] = from_union([to_float, from_none], self.cache_price) if self.cache_read_price is not None: result["cacheReadPrice"] = from_union([to_float, from_none], self.cache_read_price) if self.cache_write_price is not None: result["cacheWritePrice"] = from_union([to_float, from_none], self.cache_write_price) if self.context_max is not None: result["contextMax"] = from_union([from_int, from_none], self.context_max) if self.input_price is not None: result["inputPrice"] = from_union([to_float, from_none], self.input_price) if self.long_context is not None: result["longContext"] = from_union([lambda x: to_class(ModelBillingTokenPricesLongContext, x), from_none], self.long_context) if self.max_prompt_tokens is not None: result["maxPromptTokens"] = from_union([from_int, from_none], self.max_prompt_tokens) if self.output_price is not None: result["outputPrice"] = from_union([to_float, from_none], self.output_price) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesLimits: """Token limits for prompts, outputs, and context window""" max_context_window_tokens: int | None = None """Maximum total context window size in tokens""" max_output_tokens: int | None = None """Maximum number of output/completion tokens""" max_prompt_tokens: int | None = None """Maximum number of prompt/input tokens""" vision: ModelCapabilitiesLimitsVision | None = None """Vision-specific limits""" @staticmethod def from_dict(obj: Any) -> 'ModelCapabilitiesLimits': assert isinstance(obj, dict) max_context_window_tokens = from_union([from_int, from_none], obj.get("max_context_window_tokens")) max_output_tokens = from_union([from_int, from_none], obj.get("max_output_tokens")) max_prompt_tokens = from_union([from_int, from_none], obj.get("max_prompt_tokens")) vision = from_union([ModelCapabilitiesLimitsVision.from_dict, from_none], obj.get("vision")) return ModelCapabilitiesLimits(max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision) def to_dict(self) -> dict: result: dict = {} if self.max_context_window_tokens is not None: result["max_context_window_tokens"] = from_union([from_int, from_none], self.max_context_window_tokens) if self.max_output_tokens is not None: result["max_output_tokens"] = from_union([from_int, from_none], self.max_output_tokens) if self.max_prompt_tokens is not None: result["max_prompt_tokens"] = from_union([from_int, from_none], self.max_prompt_tokens) if self.vision is not None: result["vision"] = from_union([lambda x: to_class(ModelCapabilitiesLimitsVision, x), from_none], self.vision) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelPolicy: """Policy state (if applicable)""" state: ModelPolicyState """Current policy state for this model""" terms: str | None = None """Usage terms or conditions for this model""" @staticmethod def from_dict(obj: Any) -> 'ModelPolicy': assert isinstance(obj, dict) state = ModelPolicyState(obj.get("state")) terms = from_union([from_str, from_none], obj.get("terms")) return ModelPolicy(state, terms) def to_dict(self) -> dict: result: dict = {} result["state"] = to_enum(ModelPolicyState, self.state) if self.terms is not None: result["terms"] = from_union([from_str, from_none], self.terms) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideLimits: """Token limits for prompts, outputs, and context window""" max_context_window_tokens: int | None = None """Maximum total context window size in tokens""" max_output_tokens: int | None = None """Maximum number of output/completion tokens""" max_prompt_tokens: int | None = None """Maximum number of prompt/input tokens""" vision: ModelCapabilitiesOverrideLimitsVision | None = None """Vision-specific limits""" @staticmethod def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideLimits': assert isinstance(obj, dict) max_context_window_tokens = from_union([from_int, from_none], obj.get("max_context_window_tokens")) max_output_tokens = from_union([from_int, from_none], obj.get("max_output_tokens")) max_prompt_tokens = from_union([from_int, from_none], obj.get("max_prompt_tokens")) vision = from_union([ModelCapabilitiesOverrideLimitsVision.from_dict, from_none], obj.get("vision")) return ModelCapabilitiesOverrideLimits(max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision) def to_dict(self) -> dict: result: dict = {} if self.max_context_window_tokens is not None: result["max_context_window_tokens"] = from_union([from_int, from_none], self.max_context_window_tokens) if self.max_output_tokens is not None: result["max_output_tokens"] = from_union([from_int, from_none], self.max_output_tokens) if self.max_prompt_tokens is not None: result["max_prompt_tokens"] = from_union([from_int, from_none], self.max_prompt_tokens) if self.vision is not None: result["vision"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideLimitsVision, x), from_none], self.vision) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NamedProviderConfig: """A named BYOK provider connection (transport + credentials).""" base_url: str """API endpoint URL.""" name: str """Stable identifier referenced by BYOK model definitions. Must not contain '/'.""" api_key: str | None = None """API key. Optional for local providers like Ollama.""" azure: ProviderConfigAzure | None = None """Azure-specific provider options.""" bearer_token: str | None = None """Bearer token for authentication. Sets the Authorization header directly. Takes precedence over apiKey when both are set. """ has_bearer_token_provider: bool | None = None """When true, the SDK client supplies bearer tokens on demand: the runtime calls the client-session `providerToken.getToken` callback before each request and applies the returned token as an `Authorization: Bearer ` header. This is the bearer/OAuth scheme used by Azure AD / managed-identity tokens and provider OAuth access tokens (including Anthropic's), not a provider-specific API-key header such as Anthropic's `x-api-key`. The token-acquiring function itself stays on the SDK side and is never serialized; only this flag crosses the wire. When set alongside `apiKey`/`bearerToken`, the callback takes precedence: the runtime applies the token returned by `providerToken.getToken` as the `Authorization: Bearer` header for each request and does not send the static credential. """ headers: dict[str, str] | None = None """Custom HTTP headers to include in all outbound requests to the provider.""" transport: ProviderTransport | None = None """Provider transport. Defaults to "http".""" type: ProviderType | None = None """Provider type. Defaults to "openai" for generic OpenAI-compatible APIs.""" wire_api: ProviderWireAPI | None = None """Wire API format (openai/azure only). Defaults to "completions".""" @staticmethod def from_dict(obj: Any) -> 'NamedProviderConfig': assert isinstance(obj, dict) base_url = from_str(obj.get("baseUrl")) name = from_str(obj.get("name")) api_key = from_union([from_str, from_none], obj.get("apiKey")) azure = from_union([ProviderConfigAzure.from_dict, from_none], obj.get("azure")) bearer_token = from_union([from_str, from_none], obj.get("bearerToken")) has_bearer_token_provider = from_union([from_bool, from_none], obj.get("hasBearerTokenProvider")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) transport = from_union([ProviderTransport, from_none], obj.get("transport")) type = from_union([ProviderType, from_none], obj.get("type")) wire_api = from_union([ProviderWireAPI, from_none], obj.get("wireApi")) return NamedProviderConfig(base_url, name, api_key, azure, bearer_token, has_bearer_token_provider, headers, transport, type, wire_api) def to_dict(self) -> dict: result: dict = {} result["baseUrl"] = from_str(self.base_url) result["name"] = from_str(self.name) if self.api_key is not None: result["apiKey"] = from_union([from_str, from_none], self.api_key) if self.azure is not None: result["azure"] = from_union([lambda x: to_class(ProviderConfigAzure, x), from_none], self.azure) if self.bearer_token is not None: result["bearerToken"] = from_union([from_str, from_none], self.bearer_token) if self.has_bearer_token_provider is not None: result["hasBearerTokenProvider"] = from_union([from_bool, from_none], self.has_bearer_token_provider) if self.headers is not None: result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) if self.transport is not None: result["transport"] = from_union([lambda x: to_enum(ProviderTransport, x), from_none], self.transport) if self.type is not None: result["type"] = from_union([lambda x: to_enum(ProviderType, x), from_none], self.type) if self.wire_api is not None: result["wireApi"] = from_union([lambda x: to_enum(ProviderWireAPI, x), from_none], self.wire_api) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderConfig: """Custom model-provider configuration (BYOK).""" base_url: str """API endpoint URL.""" api_key: str | None = None """API key. Optional for local providers like Ollama.""" azure: ProviderConfigAzure | None = None """Azure-specific provider options.""" bearer_token: str | None = None """Bearer token for authentication. Sets the Authorization header directly. Takes precedence over apiKey when both are set. """ has_bearer_token_provider: bool | None = None """When true, the SDK client supplies bearer tokens on demand: the runtime calls the client-session `providerToken.getToken` callback before each request and applies the returned token as an `Authorization: Bearer ` header. This is the bearer/OAuth scheme used by Azure AD / managed-identity tokens and provider OAuth access tokens (including Anthropic's), not a provider-specific API-key header such as Anthropic's `x-api-key`. The token-acquiring function itself stays on the SDK side and is never serialized; only this flag crosses the wire. When set alongside `apiKey`/`bearerToken`, the callback takes precedence: the runtime applies the token returned by `providerToken.getToken` as the `Authorization: Bearer` header for each request and does not send the static credential. """ headers: dict[str, str] | None = None """Custom HTTP headers to include in all outbound requests to the provider.""" max_context_window_tokens: float | None = None """Maximum context window tokens for the model.""" max_output_tokens: float | None = None """Maximum output tokens for the model.""" max_prompt_tokens: float | None = None """Maximum prompt/input tokens for the model.""" model_id: str | None = None """Well-known model ID used for capability lookup. When set, agent behavior config and token limits are inferred from this model. """ transport: ProviderTransport | None = None """Provider transport. Defaults to "http".""" type: ProviderType | None = None """Provider type. Defaults to "openai" for generic OpenAI-compatible APIs.""" wire_api: ProviderWireAPI | None = None """Wire API format (openai/azure only). Defaults to "completions".""" wire_model: str | None = None """The model identifier sent to the provider API for inference (the "wire" model), as opposed to modelId which is the well-known base. """ @staticmethod def from_dict(obj: Any) -> 'ProviderConfig': assert isinstance(obj, dict) base_url = from_str(obj.get("baseUrl")) api_key = from_union([from_str, from_none], obj.get("apiKey")) azure = from_union([ProviderConfigAzure.from_dict, from_none], obj.get("azure")) bearer_token = from_union([from_str, from_none], obj.get("bearerToken")) has_bearer_token_provider = from_union([from_bool, from_none], obj.get("hasBearerTokenProvider")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) max_context_window_tokens = from_union([from_float, from_none], obj.get("maxContextWindowTokens")) max_output_tokens = from_union([from_float, from_none], obj.get("maxOutputTokens")) max_prompt_tokens = from_union([from_float, from_none], obj.get("maxPromptTokens")) model_id = from_union([from_str, from_none], obj.get("modelId")) transport = from_union([ProviderTransport, from_none], obj.get("transport")) type = from_union([ProviderType, from_none], obj.get("type")) wire_api = from_union([ProviderWireAPI, from_none], obj.get("wireApi")) wire_model = from_union([from_str, from_none], obj.get("wireModel")) return ProviderConfig(base_url, api_key, azure, bearer_token, has_bearer_token_provider, headers, max_context_window_tokens, max_output_tokens, max_prompt_tokens, model_id, transport, type, wire_api, wire_model) def to_dict(self) -> dict: result: dict = {} result["baseUrl"] = from_str(self.base_url) if self.api_key is not None: result["apiKey"] = from_union([from_str, from_none], self.api_key) if self.azure is not None: result["azure"] = from_union([lambda x: to_class(ProviderConfigAzure, x), from_none], self.azure) if self.bearer_token is not None: result["bearerToken"] = from_union([from_str, from_none], self.bearer_token) if self.has_bearer_token_provider is not None: result["hasBearerTokenProvider"] = from_union([from_bool, from_none], self.has_bearer_token_provider) if self.headers is not None: result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) if self.max_context_window_tokens is not None: result["maxContextWindowTokens"] = from_union([to_float, from_none], self.max_context_window_tokens) if self.max_output_tokens is not None: result["maxOutputTokens"] = from_union([to_float, from_none], self.max_output_tokens) if self.max_prompt_tokens is not None: result["maxPromptTokens"] = from_union([to_float, from_none], self.max_prompt_tokens) if self.model_id is not None: result["modelId"] = from_union([from_str, from_none], self.model_id) if self.transport is not None: result["transport"] = from_union([lambda x: to_enum(ProviderTransport, x), from_none], self.transport) if self.type is not None: result["type"] = from_union([lambda x: to_enum(ProviderType, x), from_none], self.type) if self.wire_api is not None: result["wireApi"] = from_union([lambda x: to_enum(ProviderWireAPI, x), from_none], self.wire_api) if self.wire_model is not None: result["wireModel"] = from_union([from_str, from_none], self.wire_model) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class OptionsUpdateAdditionalContentExclusionPolicyRule: """Schema for the `OptionsUpdateAdditionalContentExclusionPolicyRule` type.""" paths: list[str] source: OptionsUpdateAdditionalContentExclusionPolicyRuleSource """Schema for the `OptionsUpdateAdditionalContentExclusionPolicyRuleSource` type.""" if_any_match: list[str] | None = None if_none_match: list[str] | None = None @staticmethod def from_dict(obj: Any) -> 'OptionsUpdateAdditionalContentExclusionPolicyRule': assert isinstance(obj, dict) paths = from_list(from_str, obj.get("paths")) source = OptionsUpdateAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("source")) if_any_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifAnyMatch")) if_none_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifNoneMatch")) return OptionsUpdateAdditionalContentExclusionPolicyRule(paths, source, if_any_match, if_none_match) def to_dict(self) -> dict: result: dict = {} result["paths"] = from_list(from_str, self.paths) result["source"] = to_class(OptionsUpdateAdditionalContentExclusionPolicyRuleSource, self.source) if self.if_any_match is not None: result["ifAnyMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_any_match) if self.if_none_match is not None: result["ifNoneMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_none_match) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PendingPermissionRequestList: """List of pending permission requests reconstructed from event history.""" items: list[PendingPermissionRequest] """Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. """ @staticmethod def from_dict(obj: Any) -> 'PendingPermissionRequestList': assert isinstance(obj, dict) items = from_list(PendingPermissionRequest.from_dict, obj.get("items")) return PendingPermissionRequestList(items) def to_dict(self) -> dict: result: dict = {} result["items"] = from_list(lambda x: to_class(PendingPermissionRequest, x), self.items) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocation: """Schema for the `PermissionDecisionApproveForLocation` type.""" approval: PermissionDecisionApproveForLocationApproval """Approval to persist for this location""" kind: ClassVar[str] = "approve-for-location" """Approve and persist for this project location""" location_key: str """Location key (git root or cwd) to persist the approval to""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocation': assert isinstance(obj, dict) approval = _load_PermissionDecisionApproveForLocationApproval(obj.get("approval")) location_key = from_str(obj.get("locationKey")) return PermissionDecisionApproveForLocation(approval, location_key) def to_dict(self) -> dict: result: dict = {} result["approval"] = (self.approval).to_dict() result["kind"] = self.kind result["locationKey"] = from_str(self.location_key) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalCommands: """Schema for the `PermissionDecisionApproveForLocationApprovalCommands` type.""" command_identifiers: list[str] """Command identifiers covered by this approval.""" kind: ClassVar[str] = "commands" """Approval scoped to specific command identifiers.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalCommands': assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionDecisionApproveForLocationApprovalCommands(command_identifiers) def to_dict(self) -> dict: result: dict = {} result["commandIdentifiers"] = from_list(from_str, self.command_identifiers) result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalCommands: """Schema for the `PermissionDecisionApproveForSessionApprovalCommands` type.""" command_identifiers: list[str] """Command identifiers covered by this approval.""" kind: ClassVar[str] = "commands" """Approval scoped to specific command identifiers.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalCommands': assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionDecisionApproveForSessionApprovalCommands(command_identifiers) def to_dict(self) -> dict: result: dict = {} result["commandIdentifiers"] = from_list(from_str, self.command_identifiers) result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsCommands: """Schema for the `PermissionsLocationsAddToolApprovalDetailsCommands` type.""" command_identifiers: list[str] """Command identifiers covered by this approval.""" kind: ClassVar[str] = "commands" """Approval scoped to specific command identifiers.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsCommands': assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionsLocationsAddToolApprovalDetailsCommands(command_identifiers) def to_dict(self) -> dict: result: dict = {} result["commandIdentifiers"] = from_list(from_str, self.command_identifiers) result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalCustomTool: """Schema for the `PermissionDecisionApproveForLocationApprovalCustomTool` type.""" kind: ClassVar[str] = "custom-tool" """Approval covering a custom tool.""" tool_name: str """Custom tool name.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalCustomTool': assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionDecisionApproveForLocationApprovalCustomTool(tool_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["toolName"] = from_str(self.tool_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalCustomTool: """Schema for the `PermissionDecisionApproveForSessionApprovalCustomTool` type.""" kind: ClassVar[str] = "custom-tool" """Approval covering a custom tool.""" tool_name: str """Custom tool name.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalCustomTool': assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionDecisionApproveForSessionApprovalCustomTool(tool_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["toolName"] = from_str(self.tool_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsCustomTool: """Schema for the `PermissionsLocationsAddToolApprovalDetailsCustomTool` type.""" kind: ClassVar[str] = "custom-tool" """Approval covering a custom tool.""" tool_name: str """Custom tool name.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsCustomTool': assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionsLocationsAddToolApprovalDetailsCustomTool(tool_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["toolName"] = from_str(self.tool_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalExtensionManagement: """Schema for the `PermissionDecisionApproveForLocationApprovalExtensionManagement` type.""" kind: ClassVar[str] = "extension-management" """Approval covering extension lifecycle operations such as enable, disable, or reload.""" operation: str | None = None """Optional operation identifier; when omitted, the approval covers all extension management operations. """ @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalExtensionManagement': assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionDecisionApproveForLocationApprovalExtensionManagement(operation) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.operation is not None: result["operation"] = from_union([from_str, from_none], self.operation) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalExtensionManagement: """Schema for the `PermissionDecisionApproveForSessionApprovalExtensionManagement` type.""" kind: ClassVar[str] = "extension-management" """Approval covering extension lifecycle operations such as enable, disable, or reload.""" operation: str | None = None """Optional operation identifier; when omitted, the approval covers all extension management operations. """ @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalExtensionManagement': assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionDecisionApproveForSessionApprovalExtensionManagement(operation) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.operation is not None: result["operation"] = from_union([from_str, from_none], self.operation) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsExtensionManagement: """Schema for the `PermissionsLocationsAddToolApprovalDetailsExtensionManagement` type.""" kind: ClassVar[str] = "extension-management" """Approval covering extension lifecycle operations such as enable, disable, or reload.""" operation: str | None = None """Optional operation identifier; when omitted, the approval covers all extension management operations. """ @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsExtensionManagement': assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionsLocationsAddToolApprovalDetailsExtensionManagement(operation) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.operation is not None: result["operation"] = from_union([from_str, from_none], self.operation) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMCP: """Schema for the `PermissionDecisionApproveForLocationApprovalMcp` type.""" kind: ClassVar[str] = "mcp" """Approval covering an MCP tool.""" server_name: str """MCP server name.""" tool_name: str | None = None """MCP tool name, or null to cover every tool on the server.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMCP': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) return PermissionDecisionApproveForLocationApprovalMCP(server_name, tool_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["serverName"] = from_str(self.server_name) result["toolName"] = from_union([from_none, from_str], self.tool_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMCP: """Schema for the `PermissionDecisionApproveForSessionApprovalMcp` type.""" kind: ClassVar[str] = "mcp" """Approval covering an MCP tool.""" server_name: str """MCP server name.""" tool_name: str | None = None """MCP tool name, or null to cover every tool on the server.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMCP': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) return PermissionDecisionApproveForSessionApprovalMCP(server_name, tool_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["serverName"] = from_str(self.server_name) result["toolName"] = from_union([from_none, from_str], self.tool_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMCP: """Schema for the `PermissionsLocationsAddToolApprovalDetailsMcp` type.""" kind: ClassVar[str] = "mcp" """Approval covering an MCP tool.""" server_name: str """MCP server name.""" tool_name: str | None = None """MCP tool name, or null to cover every tool on the server.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMCP': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) return PermissionsLocationsAddToolApprovalDetailsMCP(server_name, tool_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["serverName"] = from_str(self.server_name) result["toolName"] = from_union([from_none, from_str], self.tool_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMCPSampling: """Schema for the `PermissionDecisionApproveForLocationApprovalMcpSampling` type.""" kind: ClassVar[str] = "mcp-sampling" """Approval covering MCP sampling requests for a server.""" server_name: str """MCP server name.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMCPSampling': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionDecisionApproveForLocationApprovalMCPSampling(server_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMCPSampling: """Schema for the `PermissionDecisionApproveForSessionApprovalMcpSampling` type.""" kind: ClassVar[str] = "mcp-sampling" """Approval covering MCP sampling requests for a server.""" server_name: str """MCP server name.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMCPSampling': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionDecisionApproveForSessionApprovalMCPSampling(server_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMCPSampling: """Schema for the `PermissionsLocationsAddToolApprovalDetailsMcpSampling` type.""" kind: ClassVar[str] = "mcp-sampling" """Approval covering MCP sampling requests for a server.""" server_name: str """MCP server name.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMCPSampling': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionsLocationsAddToolApprovalDetailsMCPSampling(server_name) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMemory: """Schema for the `PermissionDecisionApproveForLocationApprovalMemory` type.""" kind: ClassVar[str] = "memory" """Approval covering writes to long-term memory.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMemory': assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalMemory() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMemory: """Schema for the `PermissionDecisionApproveForSessionApprovalMemory` type.""" kind: ClassVar[str] = "memory" """Approval covering writes to long-term memory.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMemory': assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalMemory() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMemory: """Schema for the `PermissionsLocationsAddToolApprovalDetailsMemory` type.""" kind: ClassVar[str] = "memory" """Approval covering writes to long-term memory.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMemory': assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsMemory() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalRead: """Schema for the `PermissionDecisionApproveForLocationApprovalRead` type.""" kind: ClassVar[str] = "read" """Approval covering read-only filesystem operations.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalRead': assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalRead() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalRead: """Schema for the `PermissionDecisionApproveForSessionApprovalRead` type.""" kind: ClassVar[str] = "read" """Approval covering read-only filesystem operations.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalRead': assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalRead() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsRead: """Schema for the `PermissionsLocationsAddToolApprovalDetailsRead` type.""" kind: ClassVar[str] = "read" """Approval covering read-only filesystem operations.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsRead': assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsRead() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalWrite: """Schema for the `PermissionDecisionApproveForLocationApprovalWrite` type.""" kind: ClassVar[str] = "write" """Approval covering filesystem write operations.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalWrite': assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalWrite() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalWrite: """Schema for the `PermissionDecisionApproveForSessionApprovalWrite` type.""" kind: ClassVar[str] = "write" """Approval covering filesystem write operations.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalWrite': assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalWrite() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsWrite: """Schema for the `PermissionsLocationsAddToolApprovalDetailsWrite` type.""" kind: ClassVar[str] = "write" """Approval covering filesystem write operations.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsWrite': assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsWrite() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSession: """Schema for the `PermissionDecisionApproveForSession` type.""" kind: ClassVar[str] = "approve-for-session" """Approve and remember for the rest of the session""" approval: PermissionDecisionApproveForSessionApproval | None = None """Session-scoped approval to remember (tool prompts only; omitted for path/url prompts)""" domain: str | None = None """URL domain to approve for the rest of the session (URL prompts only)""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSession': assert isinstance(obj, dict) approval = from_union([_load_PermissionDecisionApproveForSessionApproval, from_none], obj.get("approval")) domain = from_union([from_str, from_none], obj.get("domain")) return PermissionDecisionApproveForSession(approval, domain) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.approval is not None: result["approval"] = from_union([lambda x: (x).to_dict(), from_none], self.approval) if self.domain is not None: result["domain"] = from_union([from_str, from_none], self.domain) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveOnce: """Schema for the `PermissionDecisionApproveOnce` type.""" kind: ClassVar[str] = "approve-once" """Approve this single request only""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveOnce': assert isinstance(obj, dict) return PermissionDecisionApproveOnce() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovePermanently: """Schema for the `PermissionDecisionApprovePermanently` type.""" domain: str """URL domain to approve permanently""" kind: ClassVar[str] = "approve-permanently" """Approve and persist across sessions (URL prompts only)""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApprovePermanently': assert isinstance(obj, dict) domain = from_str(obj.get("domain")) return PermissionDecisionApprovePermanently(domain) def to_dict(self) -> dict: result: dict = {} result["domain"] = from_str(self.domain) result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproved: """Schema for the `PermissionDecisionApproved` type.""" kind: ClassVar[str] = "approved" """The permission request was approved""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproved': assert isinstance(obj, dict) return PermissionDecisionApproved() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovedForLocation: """Schema for the `PermissionDecisionApprovedForLocation` type.""" approval: UserToolSessionApproval """The approval to persist for this location""" kind: ClassVar[str] = "approved-for-location" """Approved and persisted for this project location""" location_key: str """The location key (git root or cwd) to persist the approval to""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApprovedForLocation': assert isinstance(obj, dict) approval = UserToolSessionApproval.from_dict(obj.get("approval")) location_key = from_str(obj.get("locationKey")) return PermissionDecisionApprovedForLocation(approval, location_key) def to_dict(self) -> dict: result: dict = {} result["approval"] = to_class(UserToolSessionApproval, self.approval) result["kind"] = self.kind result["locationKey"] = from_str(self.location_key) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovedForSession: """Schema for the `PermissionDecisionApprovedForSession` type.""" approval: UserToolSessionApproval """The approval to add as a session-scoped rule""" kind: ClassVar[str] = "approved-for-session" """Approved and remembered for the rest of the session""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApprovedForSession': assert isinstance(obj, dict) approval = UserToolSessionApproval.from_dict(obj.get("approval")) return PermissionDecisionApprovedForSession(approval) def to_dict(self) -> dict: result: dict = {} result["approval"] = to_class(UserToolSessionApproval, self.approval) result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionCancelled: """Schema for the `PermissionDecisionCancelled` type.""" kind: ClassVar[str] = "cancelled" """The permission request was cancelled before a response was used""" reason: str | None = None """Optional explanation of why the request was cancelled""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionCancelled': assert isinstance(obj, dict) reason = from_union([from_str, from_none], obj.get("reason")) return PermissionDecisionCancelled(reason) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.reason is not None: result["reason"] = from_union([from_str, from_none], self.reason) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByContentExclusionPolicy: """Schema for the `PermissionDecisionDeniedByContentExclusionPolicy` type.""" kind: ClassVar[str] = "denied-by-content-exclusion-policy" """Denied by the organization's content exclusion policy""" message: str """Human-readable explanation of why the path was excluded""" path: str """File path that triggered the exclusion""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionDeniedByContentExclusionPolicy': assert isinstance(obj, dict) message = from_str(obj.get("message")) path = from_str(obj.get("path")) return PermissionDecisionDeniedByContentExclusionPolicy(message, path) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["message"] = from_str(self.message) result["path"] = from_str(self.path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByPermissionRequestHook: """Schema for the `PermissionDecisionDeniedByPermissionRequestHook` type.""" kind: ClassVar[str] = "denied-by-permission-request-hook" """Denied by a permission request hook registered by an extension or plugin""" interrupt: bool | None = None """Whether to interrupt the current agent turn""" message: str | None = None """Optional message from the hook explaining the denial""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionDeniedByPermissionRequestHook': assert isinstance(obj, dict) interrupt = from_union([from_bool, from_none], obj.get("interrupt")) message = from_union([from_str, from_none], obj.get("message")) return PermissionDecisionDeniedByPermissionRequestHook(interrupt, message) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.interrupt is not None: result["interrupt"] = from_union([from_bool, from_none], self.interrupt) if self.message is not None: result["message"] = from_union([from_str, from_none], self.message) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByRules: """Schema for the `PermissionDecisionDeniedByRules` type.""" kind: ClassVar[str] = "denied-by-rules" """Denied because approval rules explicitly blocked it""" rules: list[PermissionRule] """Rules that denied the request""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionDeniedByRules': assert isinstance(obj, dict) rules = from_list(PermissionRule.from_dict, obj.get("rules")) return PermissionDecisionDeniedByRules(rules) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["rules"] = from_list(lambda x: to_class(PermissionRule, x), self.rules) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedInteractivelyByUser: """Schema for the `PermissionDecisionDeniedInteractivelyByUser` type.""" kind: ClassVar[str] = "denied-interactively-by-user" """Denied by the user during an interactive prompt""" feedback: str | None = None """Optional feedback from the user explaining the denial""" force_reject: bool | None = None """Whether to force-reject the current agent turn""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionDeniedInteractivelyByUser': assert isinstance(obj, dict) feedback = from_union([from_str, from_none], obj.get("feedback")) force_reject = from_union([from_bool, from_none], obj.get("forceReject")) return PermissionDecisionDeniedInteractivelyByUser(feedback, force_reject) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.feedback is not None: result["feedback"] = from_union([from_str, from_none], self.feedback) if self.force_reject is not None: result["forceReject"] = from_union([from_bool, from_none], self.force_reject) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser: """Schema for the `PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser` type.""" kind: ClassVar[str] = "denied-no-approval-rule-and-could-not-request-from-user" """Denied because no approval rule matched and user confirmation was unavailable""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser': assert isinstance(obj, dict) return PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionReject: """Schema for the `PermissionDecisionReject` type.""" kind: ClassVar[str] = "reject" """Reject the request""" feedback: str | None = None """Optional feedback explaining the rejection""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionReject': assert isinstance(obj, dict) feedback = from_union([from_str, from_none], obj.get("feedback")) return PermissionDecisionReject(feedback) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.feedback is not None: result["feedback"] = from_union([from_str, from_none], self.feedback) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionUserNotAvailable: """Schema for the `PermissionDecisionUserNotAvailable` type.""" kind: ClassVar[str] = "user-not-available" """No user is available to confirm the request""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionUserNotAvailable': assert isinstance(obj, dict) return PermissionDecisionUserNotAvailable() def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationApplyResult: """Summary of persisted location permissions applied to the session.""" applied_directory_count: int """Number of persisted allowed directories added to the live path manager""" applied_rule_count: int """Number of location-scoped rules added to the live permission service""" applied_rules: list[PermissionRule] """Location-scoped rules applied to the live permission service""" changed: bool """Whether a different location was applied since the previous apply call""" location_key: str """Location key used in the location-permissions store""" location_type: PermissionLocationType """Whether the location is a git repo or directory""" @staticmethod def from_dict(obj: Any) -> 'PermissionLocationApplyResult': assert isinstance(obj, dict) applied_directory_count = from_int(obj.get("appliedDirectoryCount")) applied_rule_count = from_int(obj.get("appliedRuleCount")) applied_rules = from_list(PermissionRule.from_dict, obj.get("appliedRules")) changed = from_bool(obj.get("changed")) location_key = from_str(obj.get("locationKey")) location_type = PermissionLocationType(obj.get("locationType")) return PermissionLocationApplyResult(applied_directory_count, applied_rule_count, applied_rules, changed, location_key, location_type) def to_dict(self) -> dict: result: dict = {} result["appliedDirectoryCount"] = from_int(self.applied_directory_count) result["appliedRuleCount"] = from_int(self.applied_rule_count) result["appliedRules"] = from_list(lambda x: to_class(PermissionRule, x), self.applied_rules) result["changed"] = from_bool(self.changed) result["locationKey"] = from_str(self.location_key) result["locationType"] = to_enum(PermissionLocationType, self.location_type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationResolveResult: """Resolved location-permissions key and type.""" location_key: str """Location key used in the location-permissions store""" location_type: PermissionLocationType """Whether the location is a git repo or directory""" @staticmethod def from_dict(obj: Any) -> 'PermissionLocationResolveResult': assert isinstance(obj, dict) location_key = from_str(obj.get("locationKey")) location_type = PermissionLocationType(obj.get("locationType")) return PermissionLocationResolveResult(location_key, location_type) def to_dict(self) -> dict: result: dict = {} result["locationKey"] = from_str(self.location_key) result["locationType"] = to_enum(PermissionLocationType, self.location_type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicyRule: """Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRule` type.""" paths: list[str] source: PermissionsConfigureAdditionalContentExclusionPolicyRuleSource """Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRuleSource` type.""" if_any_match: list[str] | None = None if_none_match: list[str] | None = None @staticmethod def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicyRule': assert isinstance(obj, dict) paths = from_list(from_str, obj.get("paths")) source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("source")) if_any_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifAnyMatch")) if_none_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifNoneMatch")) return PermissionsConfigureAdditionalContentExclusionPolicyRule(paths, source, if_any_match, if_none_match) def to_dict(self) -> dict: result: dict = {} result["paths"] = from_list(from_str, self.paths) result["source"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.source) if self.if_any_match is not None: result["ifAnyMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_any_match) if self.if_none_match is not None: result["ifNoneMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_none_match) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsModifyRulesParams: """Scope and add/remove instructions for modifying session- or location-scoped permission rules. """ scope: PermissionsModifyRulesScope """Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. """ add: list[PermissionRule] | None = None """Rules to add to the scope. Applied before `remove`/`removeAll`.""" remove: list[PermissionRule] | None = None """Specific rules to remove from the scope. Ignored when `removeAll` is true.""" remove_all: bool | None = None """When true, removes every rule currently in the scope (after any `add` is applied). Useful for clearing the location scope wholesale. """ @staticmethod def from_dict(obj: Any) -> 'PermissionsModifyRulesParams': assert isinstance(obj, dict) scope = PermissionsModifyRulesScope(obj.get("scope")) add = from_union([lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("add")) remove = from_union([lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("remove")) remove_all = from_union([from_bool, from_none], obj.get("removeAll")) return PermissionsModifyRulesParams(scope, add, remove, remove_all) def to_dict(self) -> dict: result: dict = {} result["scope"] = to_enum(PermissionsModifyRulesScope, self.scope) if self.add is not None: result["add"] = from_union([lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], self.add) if self.remove is not None: result["remove"] = from_union([lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], self.remove) if self.remove_all is not None: result["removeAll"] = from_union([from_bool, from_none], self.remove_all) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanReadSQLTodosResult: """Todo rows read from the session SQL database. Empty when no session database is available.""" rows: list[PlanSQLTodosRow] """Rows from the session SQL todos table, ordered by creation time and id.""" @staticmethod def from_dict(obj: Any) -> 'PlanReadSQLTodosResult': assert isinstance(obj, dict) rows = from_list(PlanSQLTodosRow.from_dict, obj.get("rows")) return PlanReadSQLTodosResult(rows) def to_dict(self) -> dict: result: dict = {} result["rows"] = from_list(lambda x: to_class(PlanSQLTodosRow, x), self.rows) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanReadSQLTodosWithDependenciesResult: """Todo rows + dependency edges read from the session SQL database.""" dependencies: list[PlanSQLTodoDependency] """Edges from the session SQL todo_deps table. Empty when no database, no todo_deps table, or the SELECT failed. Read independently from `rows`, so a broken todo_deps table does not affect the rows result and vice versa. """ rows: list[PlanSQLTodosRow] """Rows from the session SQL todos table, ordered by creation time and id. Empty when no database, no todos table, or the SELECT failed. """ @staticmethod def from_dict(obj: Any) -> 'PlanReadSQLTodosWithDependenciesResult': assert isinstance(obj, dict) dependencies = from_list(PlanSQLTodoDependency.from_dict, obj.get("dependencies")) rows = from_list(PlanSQLTodosRow.from_dict, obj.get("rows")) return PlanReadSQLTodosWithDependenciesResult(dependencies, rows) def to_dict(self) -> dict: result: dict = {} result["dependencies"] = from_list(lambda x: to_class(PlanSQLTodoDependency, x), self.dependencies) result["rows"] = from_list(lambda x: to_class(PlanSQLTodosRow, x), self.rows) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class DiscoveredMCPServer: """Schema for the `DiscoveredMcpServer` type.""" enabled: bool """Whether the server is enabled (not in the disabled list)""" name: str """Server name (config key)""" source: McpServerSource """Configuration source: user, workspace, plugin, or builtin""" source_plugin: str | None = None """Plugin name that provided this server, when source is plugin.""" source_plugin_version: str | None = None """Plugin version that provided this server, when source is plugin.""" type: DiscoveredMCPServerType | None = None """Server transport type: stdio, http, sse (deprecated), or memory""" @staticmethod def from_dict(obj: Any) -> 'DiscoveredMCPServer': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) name = from_str(obj.get("name")) source = McpServerSource(obj.get("source")) source_plugin = from_union([from_str, from_none], obj.get("sourcePlugin")) source_plugin_version = from_union([from_str, from_none], obj.get("sourcePluginVersion")) type = from_union([DiscoveredMCPServerType, from_none], obj.get("type")) return DiscoveredMCPServer(enabled, name, source, source_plugin, source_plugin_version, type) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) result["name"] = from_str(self.name) result["source"] = to_enum(McpServerSource, self.source) if self.source_plugin is not None: result["sourcePlugin"] = from_union([from_str, from_none], self.source_plugin) if self.source_plugin_version is not None: result["sourcePluginVersion"] = from_union([from_str, from_none], self.source_plugin_version) if self.type is not None: result["type"] = from_union([lambda x: to_enum(DiscoveredMCPServerType, x), from_none], self.type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginInfo: """Information about an installed plugin tracked in global state. The newly installed plugin's metadata """ enabled: bool """Whether the plugin is currently enabled for new sessions""" marketplace: str """Marketplace the plugin came from. Empty string ("") for direct repo / URL / local installs. """ name: str """Plugin name""" direct_source_id: str | None = None """Opaque, stable hash identifying a direct (non-marketplace) install source. Present only for direct repo / URL / local installs; absent for marketplace plugins. Same source yields the same id; distinct sources never collide. """ version: str | None = None """Installed version (when reported by the plugin manifest)""" @staticmethod def from_dict(obj: Any) -> 'InstalledPluginInfo': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) direct_source_id = from_union([from_str, from_none], obj.get("directSourceId")) version = from_union([from_str, from_none], obj.get("version")) return InstalledPluginInfo(enabled, marketplace, name, direct_source_id, version) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) result["marketplace"] = from_str(self.marketplace) result["name"] = from_str(self.name) if self.direct_source_id is not None: result["directSourceId"] = from_union([from_str, from_none], self.direct_source_id) if self.version is not None: result["version"] = from_union([from_str, from_none], self.version) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MarketplacePluginInfo: """Plugin entry advertised by a marketplace.""" name: str """Plugin name as listed in the marketplace catalog""" description: str | None = None """Short description from the marketplace catalog, when present""" @staticmethod def from_dict(obj: Any) -> 'MarketplacePluginInfo': assert isinstance(obj, dict) name = from_str(obj.get("name")) description = from_union([from_str, from_none], obj.get("description")) return MarketplacePluginInfo(name, description) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServer: """Schema for the `McpServer` type.""" name: str """Server name (config key)""" status: McpServerStatus """Connection status: connected, failed, needs-auth, pending, disabled, or not_configured""" error: str | None = None """Error message if the server failed to connect""" source: McpServerSource | None = None """Configuration source: user, workspace, plugin, or builtin""" source_plugin: str | None = None """Plugin name that provided this server, when source is plugin.""" source_plugin_version: str | None = None """Plugin version that provided this server, when source is plugin.""" @staticmethod def from_dict(obj: Any) -> 'MCPServer': assert isinstance(obj, dict) name = from_str(obj.get("name")) status = McpServerStatus(obj.get("status")) error = from_union([from_str, from_none], obj.get("error")) source = from_union([McpServerSource, from_none], obj.get("source")) source_plugin = from_union([from_str, from_none], obj.get("sourcePlugin")) source_plugin_version = from_union([from_str, from_none], obj.get("sourcePluginVersion")) return MCPServer(name, status, error, source, source_plugin, source_plugin_version) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["status"] = to_enum(McpServerStatus, self.status) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.source is not None: result["source"] = from_union([lambda x: to_enum(McpServerSource, x), from_none], self.source) if self.source_plugin is not None: result["sourcePlugin"] = from_union([from_str, from_none], self.source_plugin) if self.source_plugin_version is not None: result["sourcePluginVersion"] = from_union([from_str, from_none], self.source_plugin_version) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginList: """Plugins installed for the session, with their enabled state and version metadata.""" plugins: list[Plugin] """Installed plugins""" @staticmethod def from_dict(obj: Any) -> 'PluginList': assert isinstance(obj, dict) plugins = from_list(Plugin.from_dict, obj.get("plugins")) return PluginList(plugins) def to_dict(self) -> dict: result: dict = {} result["plugins"] = from_list(lambda x: to_class(Plugin, x), self.plugins) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginUpdateAllEntry: """Schema for the `PluginUpdateAllEntry` type.""" marketplace: str """Marketplace the plugin came from. Empty string ("") for direct installs.""" name: str """Plugin name that was updated""" success: bool """Whether the update succeeded for this plugin""" error: str | None = None """Error message (failure only)""" new_version: str | None = None """Version after the update, when available""" previous_version: str | None = None """Previously installed version, when available""" skills_installed: int | None = None """Number of skills installed after the update (success only)""" @staticmethod def from_dict(obj: Any) -> 'PluginUpdateAllEntry': assert isinstance(obj, dict) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) success = from_bool(obj.get("success")) error = from_union([from_str, from_none], obj.get("error")) new_version = from_union([from_str, from_none], obj.get("newVersion")) previous_version = from_union([from_str, from_none], obj.get("previousVersion")) skills_installed = from_union([from_int, from_none], obj.get("skillsInstalled")) return PluginUpdateAllEntry(marketplace, name, success, error, new_version, previous_version, skills_installed) def to_dict(self) -> dict: result: dict = {} result["marketplace"] = from_str(self.marketplace) result["name"] = from_str(self.name) result["success"] = from_bool(self.success) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.new_version is not None: result["newVersion"] = from_union([from_str, from_none], self.new_version) if self.previous_version is not None: result["previousVersion"] = from_union([from_str, from_none], self.previous_version) if self.skills_installed is not None: result["skillsInstalled"] = from_union([from_int, from_none], self.skills_installed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsDisableRequest: """Plugin names (or specs) to disable.""" names: list[str] """Plugin names or "plugin@marketplace" specs to disable. Unknown names are ignored. Non-marketplace direct installs cannot be disabled via this API; uninstall them instead. Plugin-owned MCP servers are stopped in active sessions immediately; other plugin contributions remain available until each session reloads plugins. """ @staticmethod def from_dict(obj: Any) -> 'PluginsDisableRequest': assert isinstance(obj, dict) names = from_list(from_str, obj.get("names")) return PluginsDisableRequest(names) def to_dict(self) -> dict: result: dict = {} result["names"] = from_list(from_str, self.names) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsEnableRequest: """Plugin names (or specs) to enable.""" names: list[str] """Plugin names or "plugin@marketplace" specs to enable. Unknown names are ignored. Non-marketplace direct installs are always enabled and cannot be toggled via this API. """ @staticmethod def from_dict(obj: Any) -> 'PluginsEnableRequest': assert isinstance(obj, dict) names = from_list(from_str, obj.get("names")) return PluginsEnableRequest(names) def to_dict(self) -> dict: result: dict = {} result["names"] = from_list(from_str, self.names) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsInstallRequest: """Plugin source and optional working directory for relative-path resolution.""" source: str """Plugin install spec. Accepts the same forms as the CLI: "plugin@marketplace" (marketplace install), "owner/repo" or "owner/repo:subpath" (GitHub direct), an http/https/ssh URL, or a local path. Direct (non-marketplace) installs are deprecated and will produce a deprecationWarning in the result. """ working_directory: str | None = None """Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. """ @staticmethod def from_dict(obj: Any) -> 'PluginsInstallRequest': assert isinstance(obj, dict) source = from_str(obj.get("source")) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) return PluginsInstallRequest(source, working_directory) def to_dict(self) -> dict: result: dict = {} result["source"] = from_str(self.source) if self.working_directory is not None: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsUninstallRequest: """Name (or spec) of the plugin to uninstall.""" name: str """Plugin name or "plugin@marketplace" spec to uninstall. When ambiguous, prefer the fully-qualified spec. """ direct_source_id: str | None = None """Stable source identity for a direct (non-marketplace) install. Disambiguates uninstall when multiple installed plugins share the same name. """ @staticmethod def from_dict(obj: Any) -> 'PluginsUninstallRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) direct_source_id = from_union([from_none, from_str], obj.get("directSourceId")) return PluginsUninstallRequest(name, direct_source_id) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) if self.direct_source_id is not None: result["directSourceId"] = from_union([from_none, from_str], self.direct_source_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginsUpdateRequest: """Name (or spec) of the plugin to update.""" name: str """Plugin name or "plugin@marketplace" spec to update.""" @staticmethod def from_dict(obj: Any) -> 'PluginsUpdateRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return PluginsUpdateRequest(name) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PollSpawnedSessionsResult: """Batch of spawn events plus a cursor for follow-up polls.""" cursor: str """Opaque cursor to pass back to receive only events after this batch.""" events: list[SessionsPollSpawnedSessionsEvent] """Spawn events emitted since the supplied cursor.""" @staticmethod def from_dict(obj: Any) -> 'PollSpawnedSessionsResult': assert isinstance(obj, dict) cursor = from_str(obj.get("cursor")) events = from_list(SessionsPollSpawnedSessionsEvent.from_dict, obj.get("events")) return PollSpawnedSessionsResult(cursor, events) def to_dict(self) -> dict: result: dict = {} result["cursor"] = from_str(self.cursor) result["events"] = from_list(lambda x: to_class(SessionsPollSpawnedSessionsEvent, x), self.events) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderEndpoint: """A snapshot of the provider endpoint the session is currently configured to talk to.""" base_url: str """Base URL to pass to the LLM client library.""" headers: dict[str, str] """HTTP headers the caller must include on every outbound request.""" type: ProviderType """Provider family. Matches the `type` field of a BYOK provider config.""" api_key: str | None = None """A credential the caller should use with this endpoint. Omitted only when the endpoint accepts unauthenticated requests. """ session_token: ProviderSessionToken | None = None """Short-lived, rotating credential the caller must send on every request, in addition to `apiKey` if one is present. Omitted when the endpoint does not require one. """ transport: ProviderTransport | None = None """Transport to be used for provider requests.""" wire_api: ProviderWireAPI | None = None """Wire API to be used, when required for the provider type.""" @staticmethod def from_dict(obj: Any) -> 'ProviderEndpoint': assert isinstance(obj, dict) base_url = from_str(obj.get("baseUrl")) headers = from_dict(from_str, obj.get("headers")) type = ProviderType(obj.get("type")) api_key = from_union([from_str, from_none], obj.get("apiKey")) session_token = from_union([ProviderSessionToken.from_dict, from_none], obj.get("sessionToken")) transport = from_union([ProviderTransport, from_none], obj.get("transport")) wire_api = from_union([ProviderWireAPI, from_none], obj.get("wireApi")) return ProviderEndpoint(base_url, headers, type, api_key, session_token, transport, wire_api) def to_dict(self) -> dict: result: dict = {} result["baseUrl"] = from_str(self.base_url) result["headers"] = from_dict(from_str, self.headers) result["type"] = to_enum(ProviderType, self.type) if self.api_key is not None: result["apiKey"] = from_union([from_str, from_none], self.api_key) if self.session_token is not None: result["sessionToken"] = from_union([lambda x: to_class(ProviderSessionToken, x), from_none], self.session_token) if self.transport is not None: result["transport"] = from_union([lambda x: to_enum(ProviderTransport, x), from_none], self.transport) if self.wire_api is not None: result["wireApi"] = from_union([lambda x: to_enum(ProviderWireAPI, x), from_none], self.wire_api) return result @dataclass class PushAttachmentGitHubSide: """File location on the base side of the diff. Absent for additions. One side of a file diff (head or base) File location on the head side of the diff. Absent for deletions. Base side of the comparison One side of a tree comparison (head or base) Head side of the comparison """ repo: PushGitHubRepoRef """Repository the file lives in Repository the revision belongs to """ path: str | None = None """Repository-relative path to the file""" ref: str | None = None """Git ref (branch, tag, or commit SHA) the file is read at""" revision: str | None = None """Git revision (branch, tag, or commit SHA)""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubSide': assert isinstance(obj, dict) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) revision = from_union([from_str, from_none], obj.get("revision")) return PushAttachmentGitHubSide(repo, path, ref, revision) def to_dict(self) -> dict: result: dict = {} result["repo"] = to_class(PushGitHubRepoRef, self.repo) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: result["ref"] = from_union([from_str, from_none], self.ref) if self.revision is not None: result["revision"] = from_union([from_str, from_none], self.revision) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubFileDiffSide: """File location on the base side of the diff. Absent for additions. One side of a file diff (head or base) File location on the head side of the diff. Absent for deletions. """ path: str """Repository-relative path to the file""" ref: str """Git ref (branch, tag, or commit SHA) the file is read at""" repo: PushGitHubRepoRef """Repository the file lives in""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubFileDiffSide': assert isinstance(obj, dict) path = from_str(obj.get("path")) ref = from_str(obj.get("ref")) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) return PushAttachmentGitHubFileDiffSide(path, ref, repo) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["ref"] = from_str(self.ref) result["repo"] = to_class(PushGitHubRepoRef, self.repo) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubTreeComparisonSide: """Base side of the comparison One side of a tree comparison (head or base) Head side of the comparison """ repo: PushGitHubRepoRef """Repository the revision belongs to""" revision: str """Git revision (branch, tag, or commit SHA)""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubTreeComparisonSide': assert isinstance(obj, dict) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) revision = from_str(obj.get("revision")) return PushAttachmentGitHubTreeComparisonSide(repo, revision) def to_dict(self) -> dict: result: dict = {} result["repo"] = to_class(PushGitHubRepoRef, self.repo) result["revision"] = from_str(self.revision) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentSelectionDetails: """Position range of the selection within the file""" end: PushAttachmentSelectionDetailsEnd """End position of the selection""" start: PushAttachmentSelectionDetailsStart """Start position of the selection""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentSelectionDetails': assert isinstance(obj, dict) end = PushAttachmentSelectionDetailsEnd.from_dict(obj.get("end")) start = PushAttachmentSelectionDetailsStart.from_dict(obj.get("start")) return PushAttachmentSelectionDetails(end, start) def to_dict(self) -> dict: result: dict = {} result["end"] = to_class(PushAttachmentSelectionDetailsEnd, self.end) result["start"] = to_class(PushAttachmentSelectionDetailsStart, self.start) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentBlob: """Blob attachment with inline base64-encoded data""" data: str """Base64-encoded content""" mime_type: str """MIME type of the inline data""" type: ClassVar[str] = "blob" """Attachment type discriminator""" display_name: str | None = None """User-facing display name for the attachment""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentBlob': assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) display_name = from_union([from_str, from_none], obj.get("displayName")) return PushAttachmentBlob(data, mime_type, display_name) def to_dict(self) -> dict: result: dict = {} result["data"] = from_str(self.data) result["mimeType"] = from_str(self.mime_type) result["type"] = self.type if self.display_name is not None: result["displayName"] = from_union([from_str, from_none], self.display_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentFile: """File attachment""" display_name: str """User-facing display name for the attachment""" path: str """Absolute file path""" type: ClassVar[str] = "file" """Attachment type discriminator""" line_range: PushAttachmentFileLineRange | None = None """Optional line range to scope the attachment to a specific section of the file""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentFile': assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) path = from_str(obj.get("path")) line_range = from_union([PushAttachmentFileLineRange.from_dict, from_none], obj.get("lineRange")) return PushAttachmentFile(display_name, path, line_range) def to_dict(self) -> dict: result: dict = {} result["displayName"] = from_str(self.display_name) result["path"] = from_str(self.path) result["type"] = self.type if self.line_range is not None: result["lineRange"] = from_union([lambda x: to_class(PushAttachmentFileLineRange, x), from_none], self.line_range) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubActionsJob: """Pointer to a GitHub Actions job.""" job_id: int """Job id within the workflow run""" job_name: str """Display name of the job""" repo: PushGitHubRepoRef """Repository the workflow run belongs to""" type: ClassVar[str] = "github_actions_job" """Attachment type discriminator""" url: str """URL to the job on GitHub""" workflow_name: str """Display name of the workflow the job ran in""" conclusion: str | None = None """Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs. """ @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubActionsJob': assert isinstance(obj, dict) job_id = from_int(obj.get("jobId")) job_name = from_str(obj.get("jobName")) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) url = from_str(obj.get("url")) workflow_name = from_str(obj.get("workflowName")) conclusion = from_union([from_str, from_none], obj.get("conclusion")) return PushAttachmentGitHubActionsJob(job_id, job_name, repo, url, workflow_name, conclusion) def to_dict(self) -> dict: result: dict = {} result["jobId"] = from_int(self.job_id) result["jobName"] = from_str(self.job_name) result["repo"] = to_class(PushGitHubRepoRef, self.repo) result["type"] = self.type result["url"] = from_str(self.url) result["workflowName"] = from_str(self.workflow_name) if self.conclusion is not None: result["conclusion"] = from_union([from_str, from_none], self.conclusion) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubCommit: """Pointer to a GitHub commit.""" message: str """First line of the commit message""" oid: str """Full commit SHA""" repo: PushGitHubRepoRef """Repository the commit belongs to""" type: ClassVar[str] = "github_commit" """Attachment type discriminator""" url: str """URL to the commit on GitHub""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubCommit': assert isinstance(obj, dict) message = from_str(obj.get("message")) oid = from_str(obj.get("oid")) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) url = from_str(obj.get("url")) return PushAttachmentGitHubCommit(message, oid, repo, url) def to_dict(self) -> dict: result: dict = {} result["message"] = from_str(self.message) result["oid"] = from_str(self.oid) result["repo"] = to_class(PushGitHubRepoRef, self.repo) result["type"] = self.type result["url"] = from_str(self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubFile: """Pointer to a file in a GitHub repository at a specific ref.""" path: str """Repository-relative path to the file""" ref: str """Git ref the file is read at (branch, tag, or commit SHA)""" repo: PushGitHubRepoRef """Repository the file lives in""" type: ClassVar[str] = "github_file" """Attachment type discriminator""" url: str """URL to the file on GitHub""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubFile': assert isinstance(obj, dict) path = from_str(obj.get("path")) ref = from_str(obj.get("ref")) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) url = from_str(obj.get("url")) return PushAttachmentGitHubFile(path, ref, repo, url) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["ref"] = from_str(self.ref) result["repo"] = to_class(PushGitHubRepoRef, self.repo) result["type"] = self.type result["url"] = from_str(self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubReference: """GitHub issue, pull request, or discussion reference""" number: int """Issue, pull request, or discussion number""" reference_type: PushAttachmentGitHubReferenceTypeEnum """Type of GitHub reference""" state: str """Current state of the referenced item (e.g., open, closed, merged)""" title: str """Title of the referenced item""" type: ClassVar[str] = "github_reference" """Attachment type discriminator""" url: str """URL to the referenced item on GitHub""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubReference': assert isinstance(obj, dict) number = from_int(obj.get("number")) reference_type = PushAttachmentGitHubReferenceTypeEnum(obj.get("referenceType")) state = from_str(obj.get("state")) title = from_str(obj.get("title")) url = from_str(obj.get("url")) return PushAttachmentGitHubReference(number, reference_type, state, title, url) def to_dict(self) -> dict: result: dict = {} result["number"] = from_int(self.number) result["referenceType"] = to_enum(PushAttachmentGitHubReferenceTypeEnum, self.reference_type) result["state"] = from_str(self.state) result["title"] = from_str(self.title) result["type"] = self.type result["url"] = from_str(self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubRelease: """Pointer to a GitHub release.""" name: str """Human-readable release name""" repo: PushGitHubRepoRef """Repository the release belongs to""" tag_name: str """Git tag the release is anchored to""" type: ClassVar[str] = "github_release" """Attachment type discriminator""" url: str """URL to the release on GitHub""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubRelease': assert isinstance(obj, dict) name = from_str(obj.get("name")) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) tag_name = from_str(obj.get("tagName")) url = from_str(obj.get("url")) return PushAttachmentGitHubRelease(name, repo, tag_name, url) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["repo"] = to_class(PushGitHubRepoRef, self.repo) result["tagName"] = from_str(self.tag_name) result["type"] = self.type result["url"] = from_str(self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubRepository: """Pointer to a GitHub repository.""" repo: PushGitHubRepoRef """Repository pointer""" type: ClassVar[str] = "github_repository" """Attachment type discriminator""" url: str """URL to the repository on GitHub""" description: str | None = None """Short description of the repository""" ref: str | None = None """Git ref this attachment is anchored at (branch, tag, or commit). When absent the default branch is implied. """ @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubRepository': assert isinstance(obj, dict) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) url = from_str(obj.get("url")) description = from_union([from_str, from_none], obj.get("description")) ref = from_union([from_str, from_none], obj.get("ref")) return PushAttachmentGitHubRepository(repo, url, description, ref) def to_dict(self) -> dict: result: dict = {} result["repo"] = to_class(PushGitHubRepoRef, self.repo) result["type"] = self.type result["url"] = from_str(self.url) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.ref is not None: result["ref"] = from_union([from_str, from_none], self.ref) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubSnippet: """Pointer to a line range inside a file in a GitHub repository.""" line_range: PushAttachmentFileLineRange """Line range the snippet covers""" path: str """Repository-relative path to the file""" ref: str """Git ref the file is read at (branch, tag, or commit SHA)""" repo: PushGitHubRepoRef """Repository the file lives in""" type: ClassVar[str] = "github_snippet" """Attachment type discriminator""" url: str """URL to the snippet on GitHub (with line anchor)""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubSnippet': assert isinstance(obj, dict) line_range = PushAttachmentFileLineRange.from_dict(obj.get("lineRange")) path = from_str(obj.get("path")) ref = from_str(obj.get("ref")) repo = PushGitHubRepoRef.from_dict(obj.get("repo")) url = from_str(obj.get("url")) return PushAttachmentGitHubSnippet(line_range, path, ref, repo, url) def to_dict(self) -> dict: result: dict = {} result["lineRange"] = to_class(PushAttachmentFileLineRange, self.line_range) result["path"] = from_str(self.path) result["ref"] = from_str(self.ref) result["repo"] = to_class(PushGitHubRepoRef, self.repo) result["type"] = self.type result["url"] = from_str(self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubURL: """Generic GitHub URL reference.""" type: ClassVar[str] = "github_url" """Attachment type discriminator""" url: str """URL to the GitHub resource""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubURL': assert isinstance(obj, dict) url = from_str(obj.get("url")) return PushAttachmentGitHubURL(url) def to_dict(self) -> dict: result: dict = {} result["type"] = self.type result["url"] = from_str(self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuePendingItems: """Schema for the `QueuePendingItems` type.""" display_text: str """Human-readable text to display for this queue entry in the UI""" kind: QueuePendingItemsKind """Whether this item is a queued user message or a queued slash command / model change""" @staticmethod def from_dict(obj: Any) -> 'QueuePendingItems': assert isinstance(obj, dict) display_text = from_str(obj.get("displayText")) kind = QueuePendingItemsKind(obj.get("kind")) return QueuePendingItems(display_text, kind) def to_dict(self) -> dict: result: dict = {} result["displayText"] = from_str(self.display_text) result["kind"] = to_enum(QueuePendingItemsKind, self.kind) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _RegisterExtensionToolsParams: """Params to attach an extension loader's tools to a session.""" loader: Any """In-process ExtensionLoader handle (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. When the CLI migrates to a process-separated SDK, extension discovery/launch moves entirely into the runtime — the CLI passes pure config (search paths, disabled ids) via SessionOptions instead. """ session_id: str """Session to register extension tools on.""" options: SessionsRegisterExtensionToolsOnSessionOptions | None = None """Optional registration options.""" @staticmethod def from_dict(obj: Any) -> '_RegisterExtensionToolsParams': assert isinstance(obj, dict) loader = obj.get("loader") session_id = from_str(obj.get("sessionId")) options = from_union([SessionsRegisterExtensionToolsOnSessionOptions.from_dict, from_none], obj.get("options")) return _RegisterExtensionToolsParams(loader, session_id, options) def to_dict(self) -> dict: result: dict = {} result["loader"] = self.loader result["sessionId"] = from_str(self.session_id) if self.options is not None: result["options"] = from_union([lambda x: to_class(SessionsRegisterExtensionToolsOnSessionOptions, x), from_none], self.options) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlConfig: """Configuration for the runtime-managed remote-control singleton.""" explicit: bool """Whether the user explicitly requested remote (vs. implicit session-sync). Controls warning surfacing for missing-repo cases. """ remote: bool """Whether remote export should be enabled.""" silent: bool """When true, suppresses timeline messages on successful setup.""" steerable: bool """Whether the MC session may steer the local session (write mode).""" existing_mc_session: RemoteControlConfigExistingMcSession | None = None """Reattach to an existing MC session without creating a new one.""" task_id: str | None = None """Existing Mission Control task ID to attach the exported session to.""" @staticmethod def from_dict(obj: Any) -> 'RemoteControlConfig': assert isinstance(obj, dict) explicit = from_bool(obj.get("explicit")) remote = from_bool(obj.get("remote")) silent = from_bool(obj.get("silent")) steerable = from_bool(obj.get("steerable")) existing_mc_session = from_union([RemoteControlConfigExistingMcSession.from_dict, from_none], obj.get("existingMcSession")) task_id = from_union([from_str, from_none], obj.get("taskId")) return RemoteControlConfig(explicit, remote, silent, steerable, existing_mc_session, task_id) def to_dict(self) -> dict: result: dict = {} result["explicit"] = from_bool(self.explicit) result["remote"] = from_bool(self.remote) result["silent"] = from_bool(self.silent) result["steerable"] = from_bool(self.steerable) if self.existing_mc_session is not None: result["existingMcSession"] = from_union([lambda x: to_class(RemoteControlConfigExistingMcSession, x), from_none], self.existing_mc_session) if self.task_id is not None: result["taskId"] = from_union([from_str, from_none], self.task_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlStatusActive: """Remote control is connected to a local session.""" attached_session_id: str """Session id remote control is pointed at.""" is_steerable: bool """Whether the MC session may steer this session.""" state: ClassVar[str] = "active" """Remote control state tag: active.""" frontend_url: str | None = None """MC frontend URL for this session, when known.""" # Internal: this field is an internal SDK API and is not part of the public surface. prompt_manager: Any = None """In-process prompt-manager handle (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. When the CLI migrates to a process-separated SDK, the same bidirectional prompt-routing handshake is expressed via dedicated remote-control RPCs (register/resolve) rather than a shared in-process object. """ @staticmethod def from_dict(obj: Any) -> 'RemoteControlStatusActive': assert isinstance(obj, dict) attached_session_id = from_str(obj.get("attachedSessionId")) is_steerable = from_bool(obj.get("isSteerable")) frontend_url = from_union([from_str, from_none], obj.get("frontendUrl")) prompt_manager = obj.get("promptManager") return RemoteControlStatusActive(attached_session_id, is_steerable, frontend_url, prompt_manager) def to_dict(self) -> dict: result: dict = {} result["attachedSessionId"] = from_str(self.attached_session_id) result["isSteerable"] = from_bool(self.is_steerable) result["state"] = self.state if self.frontend_url is not None: result["frontendUrl"] = from_union([from_str, from_none], self.frontend_url) if self.prompt_manager is not None: result["promptManager"] = self.prompt_manager return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlStatusConnecting: """Remote control is in the middle of initial setup.""" attached_session_id: str """Session id the connection is attaching to.""" state: ClassVar[str] = "connecting" """Remote control state tag: connecting.""" @staticmethod def from_dict(obj: Any) -> 'RemoteControlStatusConnecting': assert isinstance(obj, dict) attached_session_id = from_str(obj.get("attachedSessionId")) return RemoteControlStatusConnecting(attached_session_id) def to_dict(self) -> dict: result: dict = {} result["attachedSessionId"] = from_str(self.attached_session_id) result["state"] = self.state return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlStatusError: """The last setup attempt failed. The singleton is otherwise off.""" error: str """Human-readable error message from the last setup attempt.""" state: ClassVar[str] = "error" """Remote control state tag: setup failed.""" attached_session_id: str | None = None """Session id the failing setup attempt targeted, when known.""" @staticmethod def from_dict(obj: Any) -> 'RemoteControlStatusError': assert isinstance(obj, dict) error = from_str(obj.get("error")) attached_session_id = from_union([from_str, from_none], obj.get("attachedSessionId")) return RemoteControlStatusError(error, attached_session_id) def to_dict(self) -> dict: result: dict = {} result["error"] = from_str(self.error) result["state"] = self.state if self.attached_session_id is not None: result["attachedSessionId"] = from_union([from_str, from_none], self.attached_session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteControlStatusOff: """Remote control is not connected.""" state: ClassVar[str] = "off" """Remote control state tag: not connected.""" @staticmethod def from_dict(obj: Any) -> 'RemoteControlStatusOff': assert isinstance(obj, dict) return RemoteControlStatusOff() def to_dict(self) -> dict: result: dict = {} result["state"] = self.state return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteEnableRequest: """Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. """ mode: RemoteSessionMode | None = None """Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. """ @staticmethod def from_dict(obj: Any) -> 'RemoteEnableRequest': assert isinstance(obj, dict) mode = from_union([RemoteSessionMode, from_none], obj.get("mode")) return RemoteEnableRequest(mode) def to_dict(self) -> dict: result: dict = {} if self.mode is not None: result["mode"] = from_union([lambda x: to_enum(RemoteSessionMode, x), from_none], self.mode) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SandboxConfigUserPolicyExperimental: """Deprecated legacy location for `seatbelt`; read only when the top-level `seatbelt` is absent. Platform-specific experimental policy fields. """ seatbelt: SandboxConfigUserPolicyExperimentalSeatbelt | None = None """macOS seatbelt experimental options.""" @staticmethod def from_dict(obj: Any) -> 'SandboxConfigUserPolicyExperimental': assert isinstance(obj, dict) seatbelt = from_union([SandboxConfigUserPolicyExperimentalSeatbelt.from_dict, from_none], obj.get("seatbelt")) return SandboxConfigUserPolicyExperimental(seatbelt) def to_dict(self) -> dict: result: dict = {} if self.seatbelt is not None: result["seatbelt"] = from_union([lambda x: to_class(SandboxConfigUserPolicyExperimentalSeatbelt, x), from_none], self.seatbelt) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleList: """Snapshot of the currently active recurring prompts for this session.""" entries: list[ScheduleEntry] """Active scheduled prompts, ordered by id.""" @staticmethod def from_dict(obj: Any) -> 'ScheduleList': assert isinstance(obj, dict) entries = from_list(ScheduleEntry.from_dict, obj.get("entries")) return ScheduleList(entries) def to_dict(self) -> dict: result: dict = {} result["entries"] = from_list(lambda x: to_class(ScheduleEntry, x), self.entries) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleStopResult: """Remove a scheduled prompt by id. The result entry is omitted if the id was unknown.""" entry: ScheduleEntry | None = None """The removed entry, or omitted if no entry matched.""" @staticmethod def from_dict(obj: Any) -> 'ScheduleStopResult': assert isinstance(obj, dict) entry = from_union([ScheduleEntry.from_dict, from_none], obj.get("entry")) return ScheduleStopResult(entry) def to_dict(self) -> dict: result: dict = {} if self.entry is not None: result["entry"] = from_union([lambda x: to_class(ScheduleEntry, x), from_none], self.entry) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendRequest: """Parameters for sending a user message to the session""" prompt: str """The user message text""" agent_mode: SendAgentMode | None = None """The UI mode the agent was in when this message was sent. Defaults to the session's current mode. """ attachments: list[Attachment] | None = None """Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message """ billable: bool | None = None """If false, this message will not trigger a Premium Request Unit charge. User messages default to billable. """ display_prompt: str | None = None """If provided, this is shown in the timeline instead of `prompt`""" mode: SendMode | None = None """How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. """ prepend: bool | None = None """If true, adds the message to the front of the queue instead of the end""" request_headers: dict[str, str] | None = None """Custom HTTP headers to include in outbound model requests for this turn. Merged with session-level provider headers; per-turn headers augment and overwrite session-level headers with the same key. """ required_tool: str | None = None """If set, the request will fail if the named tool is not available when this message is among the user messages at the start of the current exchange """ # Internal: this field is an internal SDK API and is not part of the public surface. source: str | None = None """Optional provenance tag copied to the resulting user.message event. Must match one of three forms: the literal `system`, `command-` for messages originating from a command (e.g. slash command, Mission Control command), or `schedule-` for messages originating from a scheduled job. """ traceparent: str | None = None """W3C Trace Context traceparent header for distributed tracing of this agent turn""" tracestate: str | None = None """W3C Trace Context tracestate header for distributed tracing""" wait: bool | None = None """If true, await completion of the agentic loop for this message before returning. Defaults to false (fire-and-forget). When true, the result still contains the same `messageId`; the caller can rely on the agent having processed the message before the call resolves. """ @staticmethod def from_dict(obj: Any) -> 'SendRequest': assert isinstance(obj, dict) prompt = from_str(obj.get("prompt")) agent_mode = from_union([SendAgentMode, from_none], obj.get("agentMode")) attachments = from_union([lambda x: from_list(Attachment.from_dict, x), from_none], obj.get("attachments")) billable = from_union([from_bool, from_none], obj.get("billable")) display_prompt = from_union([from_str, from_none], obj.get("displayPrompt")) mode = from_union([SendMode, from_none], obj.get("mode")) prepend = from_union([from_bool, from_none], obj.get("prepend")) request_headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("requestHeaders")) required_tool = from_union([from_str, from_none], obj.get("requiredTool")) source = from_union([from_str, from_none], obj.get("source")) traceparent = from_union([from_str, from_none], obj.get("traceparent")) tracestate = from_union([from_str, from_none], obj.get("tracestate")) wait = from_union([from_bool, from_none], obj.get("wait")) return SendRequest(prompt, agent_mode, attachments, billable, display_prompt, mode, prepend, request_headers, required_tool, source, traceparent, tracestate, wait) def to_dict(self) -> dict: result: dict = {} result["prompt"] = from_str(self.prompt) if self.agent_mode is not None: result["agentMode"] = from_union([lambda x: to_enum(SendAgentMode, x), from_none], self.agent_mode) if self.attachments is not None: result["attachments"] = from_union([lambda x: from_list(lambda x: to_class(Attachment, x), x), from_none], self.attachments) if self.billable is not None: result["billable"] = from_union([from_bool, from_none], self.billable) if self.display_prompt is not None: result["displayPrompt"] = from_union([from_str, from_none], self.display_prompt) if self.mode is not None: result["mode"] = from_union([lambda x: to_enum(SendMode, x), from_none], self.mode) if self.prepend is not None: result["prepend"] = from_union([from_bool, from_none], self.prepend) if self.request_headers is not None: result["requestHeaders"] = from_union([lambda x: from_dict(from_str, x), from_none], self.request_headers) if self.required_tool is not None: result["requiredTool"] = from_union([from_str, from_none], self.required_tool) if self.source is not None: result["source"] = from_union([from_str, from_none], self.source) if self.traceparent is not None: result["traceparent"] = from_union([from_str, from_none], self.traceparent) if self.tracestate is not None: result["tracestate"] = from_union([from_str, from_none], self.tracestate) if self.wait is not None: result["wait"] = from_union([from_bool, from_none], self.wait) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ServerSkillList: """Skills discovered across global and project sources.""" skills: list[ServerSkill] """All discovered skills across all sources""" @staticmethod def from_dict(obj: Any) -> 'ServerSkillList': assert isinstance(obj, dict) skills = from_list(ServerSkill.from_dict, obj.get("skills")) return ServerSkillList(skills) def to_dict(self) -> dict: result: dict = {} result["skills"] = from_list(lambda x: to_class(ServerSkill, x), self.skills) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSError: """Describes a filesystem error.""" code: SessionFSErrorCode """Error classification""" message: str | None = None """Free-form detail about the error, for logging/diagnostics""" @staticmethod def from_dict(obj: Any) -> 'SessionFSError': assert isinstance(obj, dict) code = SessionFSErrorCode(obj.get("code")) message = from_union([from_str, from_none], obj.get("message")) return SessionFSError(code, message) def to_dict(self) -> dict: result: dict = {} result["code"] = to_enum(SessionFSErrorCode, self.code) if self.message is not None: result["message"] = from_union([from_str, from_none], self.message) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSetProviderRequest: """Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. """ conventions: SessionFSSetProviderConventions """Path conventions used by this filesystem""" initial_cwd: str """Initial working directory for sessions""" session_state_path: str """Path within each session's SessionFs where the runtime stores files for that session""" capabilities: SessionFSSetProviderCapabilities | None = None """Optional capabilities declared by the provider""" @staticmethod def from_dict(obj: Any) -> 'SessionFSSetProviderRequest': assert isinstance(obj, dict) conventions = SessionFSSetProviderConventions(obj.get("conventions")) initial_cwd = from_str(obj.get("initialCwd")) session_state_path = from_str(obj.get("sessionStatePath")) capabilities = from_union([SessionFSSetProviderCapabilities.from_dict, from_none], obj.get("capabilities")) return SessionFSSetProviderRequest(conventions, initial_cwd, session_state_path, capabilities) def to_dict(self) -> dict: result: dict = {} result["conventions"] = to_enum(SessionFSSetProviderConventions, self.conventions) result["initialCwd"] = from_str(self.initial_cwd) result["sessionStatePath"] = from_str(self.session_state_path) if self.capabilities is not None: result["capabilities"] = from_union([lambda x: to_class(SessionFSSetProviderCapabilities, x), from_none], self.capabilities) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSqliteQueryRequest: """SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. """ query: str """SQL query to execute""" query_type: SessionFSSqliteQueryType """How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) """ session_id: str """Target session identifier""" params: dict[str, Any] | None = None """Optional named bind parameters""" @staticmethod def from_dict(obj: Any) -> 'SessionFSSqliteQueryRequest': assert isinstance(obj, dict) query = from_str(obj.get("query")) query_type = SessionFSSqliteQueryType(obj.get("queryType")) session_id = from_str(obj.get("sessionId")) params = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("params")) return SessionFSSqliteQueryRequest(query, query_type, session_id, params) def to_dict(self) -> dict: result: dict = {} result["query"] = from_str(self.query) result["queryType"] = to_enum(SessionFSSqliteQueryType, self.query_type) result["sessionId"] = from_str(self.session_id) if self.params is not None: result["params"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.params) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionOpenOptionsAdditionalContentExclusionPolicyRule: """Schema for the `SessionOpenOptionsAdditionalContentExclusionPolicyRule` type.""" paths: list[str] source: SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource """Schema for the `SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource` type.""" if_any_match: list[str] | None = None if_none_match: list[str] | None = None @staticmethod def from_dict(obj: Any) -> 'SessionOpenOptionsAdditionalContentExclusionPolicyRule': assert isinstance(obj, dict) paths = from_list(from_str, obj.get("paths")) source = SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("source")) if_any_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifAnyMatch")) if_none_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifNoneMatch")) return SessionOpenOptionsAdditionalContentExclusionPolicyRule(paths, source, if_any_match, if_none_match) def to_dict(self) -> dict: result: dict = {} result["paths"] = from_list(from_str, self.paths) result["source"] = to_class(SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource, self.source) if self.if_any_match is not None: result["ifAnyMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_any_match) if self.if_none_match is not None: result["ifNoneMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_none_match) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsOpenProgress: """Schema for the `SessionsOpenProgress` type.""" status: SessionsOpenProgressStatus """Step status.""" step: SessionsOpenProgressStep """Handoff step.""" message: str | None = None """Optional step message.""" @staticmethod def from_dict(obj: Any) -> 'SessionsOpenProgress': assert isinstance(obj, dict) status = SessionsOpenProgressStatus(obj.get("status")) step = SessionsOpenProgressStep(obj.get("step")) message = from_union([from_str, from_none], obj.get("message")) return SessionsOpenProgress(status, step, message) def to_dict(self) -> dict: result: dict = {} result["status"] = to_enum(SessionsOpenProgressStatus, self.status) result["step"] = to_enum(SessionsOpenProgressStep, self.step) if self.message is not None: result["message"] = from_union([from_str, from_none], self.message) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsListRequest: """Optional source filter, metadata-load limit, and context filter applied to the returned sessions. """ filter: SessionListFilter | None = None """Optional filter applied to the returned sessions""" include_detached: bool | None = None """When true, include detached maintenance sessions. Defaults to false for user-facing session lists. """ metadata_limit: int | None = None """When provided, only the first N local sessions (sorted by modification time, newest first) load full metadata; remaining sessions return basic info only. Use 0 to return only basic info for every local session. Has no effect on remote entries (which always carry their full shape). """ source: SessionSource | None = None """Which session sources to include. Defaults to `local` for backward compatibility.""" throw_on_error: bool | None = None """Only meaningful when `source` includes remote. When true, propagates errors from the remote service instead of silently returning an empty remote list. Defaults to false. """ @staticmethod def from_dict(obj: Any) -> 'SessionsListRequest': assert isinstance(obj, dict) filter = from_union([SessionListFilter.from_dict, from_none], obj.get("filter")) include_detached = from_union([from_bool, from_none], obj.get("includeDetached")) metadata_limit = from_union([from_int, from_none], obj.get("metadataLimit")) source = from_union([SessionSource, from_none], obj.get("source")) throw_on_error = from_union([from_bool, from_none], obj.get("throwOnError")) return SessionsListRequest(filter, include_detached, metadata_limit, source, throw_on_error) def to_dict(self) -> dict: result: dict = {} if self.filter is not None: result["filter"] = from_union([lambda x: to_class(SessionListFilter, x), from_none], self.filter) if self.include_detached is not None: result["includeDetached"] = from_union([from_bool, from_none], self.include_detached) if self.metadata_limit is not None: result["metadataLimit"] = from_union([from_int, from_none], self.metadata_limit) if self.source is not None: result["source"] = from_union([lambda x: to_enum(SessionSource, x), from_none], self.source) if self.throw_on_error is not None: result["throwOnError"] = from_union([from_bool, from_none], self.throw_on_error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class VisibilityGetResult: """Current sharing status and shareable GitHub URL for a session.""" synced: bool """Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the session cannot be shared and `status`/`shareUrl` are absent. """ share_url: str | None = None """Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. """ status: SessionVisibilityStatus | None = None """Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). """ @staticmethod def from_dict(obj: Any) -> 'VisibilityGetResult': assert isinstance(obj, dict) synced = from_bool(obj.get("synced")) share_url = from_union([from_str, from_none], obj.get("shareUrl")) status = from_union([SessionVisibilityStatus, from_none], obj.get("status")) return VisibilityGetResult(synced, share_url, status) def to_dict(self) -> dict: result: dict = {} result["synced"] = from_bool(self.synced) if self.share_url is not None: result["shareUrl"] = from_union([from_str, from_none], self.share_url) if self.status is not None: result["status"] = from_union([lambda x: to_enum(SessionVisibilityStatus, x), from_none], self.status) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class VisibilitySetRequest: """Desired sharing status for the session.""" status: SessionVisibilityStatus """Sharing status to apply. "repo" makes the session visible to repository readers; "unshared" restricts it to the creator and collaborators. """ @staticmethod def from_dict(obj: Any) -> 'VisibilitySetRequest': assert isinstance(obj, dict) status = SessionVisibilityStatus(obj.get("status")) return VisibilitySetRequest(status) def to_dict(self) -> dict: result: dict = {} result["status"] = to_enum(SessionVisibilityStatus, self.status) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class VisibilitySetResult: """Effective sharing status and shareable GitHub URL after updating session visibility.""" synced: bool """Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the visibility change could not be applied and `status`/`shareUrl` are absent. """ share_url: str | None = None """Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. """ status: SessionVisibilityStatus | None = None """Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). """ @staticmethod def from_dict(obj: Any) -> 'VisibilitySetResult': assert isinstance(obj, dict) synced = from_bool(obj.get("synced")) share_url = from_union([from_str, from_none], obj.get("shareUrl")) status = from_union([SessionVisibilityStatus, from_none], obj.get("status")) return VisibilitySetResult(synced, share_url, status) def to_dict(self) -> dict: result: dict = {} result["synced"] = from_bool(self.synced) if self.share_url is not None: result["shareUrl"] = from_union([from_str, from_none], self.share_url) if self.status is not None: result["status"] = from_union([lambda x: to_enum(SessionVisibilityStatus, x), from_none], self.status) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsOpenAttach: """Parameters for attaching to an already-active session by ID.""" kind: ClassVar[str] = "attach" """Attach to an already-active in-process session by ID. Unlike `resume`, this does NOT re-load from disk; the session must already be loaded by an earlier `create`/`resume` call. Returns `status: 'not_found'` when no active session matches the id. Useful for in-process consumers that need a fresh API handle to a session opened elsewhere (e.g., a peer foreground-session switch). """ session_id: str """Session ID to attach to.""" @staticmethod def from_dict(obj: Any) -> 'SessionsOpenAttach': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsOpenAttach(session_id) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellKillRequest: """Identifier of a process previously returned by "shell.exec" and the signal to send.""" process_id: str """Process identifier returned by shell.exec""" signal: ShellKillSignal | None = None """Signal to send (default: SIGTERM)""" @staticmethod def from_dict(obj: Any) -> 'ShellKillRequest': assert isinstance(obj, dict) process_id = from_str(obj.get("processId")) signal = from_union([ShellKillSignal, from_none], obj.get("signal")) return ShellKillRequest(process_id, signal) def to_dict(self) -> dict: result: dict = {} result["processId"] = from_str(self.process_id) if self.signal is not None: result["signal"] = from_union([lambda x: to_enum(ShellKillSignal, x), from_none], self.signal) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentInfo: """Schema for the `AgentInfo` type. The newly selected custom agent """ description: str """Description of the agent's purpose""" display_name: str """Human-readable display name""" id: str """Stable identifier for selection. For most agents this is the same as `name`; for plugin/builtin agents it may differ. Always populated; defaults to `name` when no distinct id was assigned. """ name: str """Unique identifier of the custom agent""" mcp_servers: dict[str, Any] | None = None """MCP server configurations attached to this agent, keyed by server name. Server config shape mirrors the MCP `mcpServers` schema. """ model: str | None = None """Preferred model id for this agent. When omitted, inherits the outer agent's model.""" path: str | None = None """Absolute local file path of the agent definition. Only set for file-based agents loaded from disk; remote agents do not have a path. """ skills: list[str] | None = None """Skill names preloaded into this agent's context. Omitted means none.""" source: AgentInfoSource | None = None """Where the agent definition was loaded from""" tools: list[str] | None = None """Allowed tool names for this agent. Empty array means none; omitted means inherit defaults.""" user_invocable: bool | None = None """Whether the agent can be selected directly by the user. Agents marked `false` are subagent-only. """ @staticmethod def from_dict(obj: Any) -> 'AgentInfo': assert isinstance(obj, dict) description = from_str(obj.get("description")) display_name = from_str(obj.get("displayName")) id = from_str(obj.get("id")) name = from_str(obj.get("name")) mcp_servers = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("mcpServers")) model = from_union([from_str, from_none], obj.get("model")) path = from_union([from_str, from_none], obj.get("path")) skills = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skills")) source = from_union([AgentInfoSource, from_none], obj.get("source")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) user_invocable = from_union([from_bool, from_none], obj.get("userInvocable")) return AgentInfo(description, display_name, id, name, mcp_servers, model, path, skills, source, tools, user_invocable) def to_dict(self) -> dict: result: dict = {} result["description"] = from_str(self.description) result["displayName"] = from_str(self.display_name) result["id"] = from_str(self.id) result["name"] = from_str(self.name) if self.mcp_servers is not None: result["mcpServers"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.mcp_servers) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.skills is not None: result["skills"] = from_union([lambda x: from_list(from_str, x), from_none], self.skills) if self.source is not None: result["source"] = from_union([lambda x: to_enum(AgentInfoSource, x), from_none], self.source) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.user_invocable is not None: result["userInvocable"] = from_union([from_bool, from_none], self.user_invocable) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillList: """Skills available to the session, with their enabled state.""" skills: list[Skill] """Available skills""" @staticmethod def from_dict(obj: Any) -> 'SkillList': assert isinstance(obj, dict) skills = from_list(Skill.from_dict, obj.get("skills")) return SkillList(skills) def to_dict(self) -> dict: result: dict = {} result["skills"] = from_list(lambda x: to_class(Skill, x), self.skills) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsConfigSetDisabledSkillsRequest: """Skill names to mark as disabled in global configuration, replacing any previous list.""" disabled_skills: list[str] """List of skill names to disable""" @staticmethod def from_dict(obj: Any) -> 'SkillsConfigSetDisabledSkillsRequest': assert isinstance(obj, dict) disabled_skills = from_list(from_str, obj.get("disabledSkills")) return SkillsConfigSetDisabledSkillsRequest(disabled_skills) def to_dict(self) -> dict: result: dict = {} result["disabledSkills"] = from_list(from_str, self.disabled_skills) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillDiscoveryPath: """Schema for the `SkillDiscoveryPath` type.""" path: str """Absolute path of the create/discovery target (may not exist on disk yet)""" preferred_for_creation: bool """Whether this is the canonical directory to create a new skill in its tier. At most one entry per tier is preferred; the `personal-agents` and `custom` scopes are never preferred. """ scope: SkillDiscoveryScope """Which tier this directory belongs to""" project_path: str | None = None """The input project path this directory was derived from (only for project scope)""" @staticmethod def from_dict(obj: Any) -> 'SkillDiscoveryPath': assert isinstance(obj, dict) path = from_str(obj.get("path")) preferred_for_creation = from_bool(obj.get("preferredForCreation")) scope = SkillDiscoveryScope(obj.get("scope")) project_path = from_union([from_str, from_none], obj.get("projectPath")) return SkillDiscoveryPath(path, preferred_for_creation, scope, project_path) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) result["preferredForCreation"] = from_bool(self.preferred_for_creation) result["scope"] = to_enum(SkillDiscoveryScope, self.scope) if self.project_path is not None: result["projectPath"] = from_union([from_str, from_none], self.project_path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsGetInvokedResult: """Skills invoked during this session, ordered by invocation time (most recent last).""" skills: list[SkillsInvokedSkill] """Skills invoked during this session, ordered by invocation time (most recent last)""" @staticmethod def from_dict(obj: Any) -> 'SkillsGetInvokedResult': assert isinstance(obj, dict) skills = from_list(SkillsInvokedSkill.from_dict, obj.get("skills")) return SkillsGetInvokedResult(skills) def to_dict(self) -> dict: result: dict = {} result["skills"] = from_list(lambda x: to_class(SkillsInvokedSkill, x), self.skills) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandAgentPromptResult: """Schema for the `SlashCommandAgentPromptResult` type.""" display_prompt: str """Prompt text to display to the user""" kind: ClassVar[str] = "agent-prompt" """Agent prompt result discriminator""" prompt: str """Prompt to submit to the agent""" mode: SessionMode | None = None """Optional target session mode for the agent prompt""" runtime_settings_changed: bool | None = None """True when the invocation mutated user runtime settings; consumers caching settings should refresh """ @staticmethod def from_dict(obj: Any) -> 'SlashCommandAgentPromptResult': assert isinstance(obj, dict) display_prompt = from_str(obj.get("displayPrompt")) prompt = from_str(obj.get("prompt")) mode = from_union([SessionMode, from_none], obj.get("mode")) runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) return SlashCommandAgentPromptResult(display_prompt, prompt, mode, runtime_settings_changed) def to_dict(self) -> dict: result: dict = {} result["displayPrompt"] = from_str(self.display_prompt) result["kind"] = self.kind result["prompt"] = from_str(self.prompt) if self.mode is not None: result["mode"] = from_union([lambda x: to_enum(SessionMode, x), from_none], self.mode) if self.runtime_settings_changed is not None: result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandCompletedResult: """Schema for the `SlashCommandCompletedResult` type.""" kind: ClassVar[str] = "completed" """Completed result discriminator""" message: str | None = None """Optional user-facing message describing the completed command""" runtime_settings_changed: bool | None = None """True when the invocation mutated user runtime settings; consumers caching settings should refresh """ @staticmethod def from_dict(obj: Any) -> 'SlashCommandCompletedResult': assert isinstance(obj, dict) message = from_union([from_str, from_none], obj.get("message")) runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) return SlashCommandCompletedResult(message, runtime_settings_changed) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.message is not None: result["message"] = from_union([from_str, from_none], self.message) if self.runtime_settings_changed is not None: result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandSelectSubcommandResult: """Schema for the `SlashCommandSelectSubcommandResult` type.""" command: str """Parent command name that requires subcommand selection""" kind: ClassVar[str] = "select-subcommand" """Select subcommand result discriminator""" options: list[SlashCommandSelectSubcommandOption] """Available subcommand options for the client to present""" title: str """Human-readable title for the selection UI""" runtime_settings_changed: bool | None = None """True when the invocation mutated user runtime settings; consumers caching settings should refresh """ @staticmethod def from_dict(obj: Any) -> 'SlashCommandSelectSubcommandResult': assert isinstance(obj, dict) command = from_str(obj.get("command")) options = from_list(SlashCommandSelectSubcommandOption.from_dict, obj.get("options")) title = from_str(obj.get("title")) runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) return SlashCommandSelectSubcommandResult(command, options, title, runtime_settings_changed) def to_dict(self) -> dict: result: dict = {} result["command"] = from_str(self.command) result["kind"] = self.kind result["options"] = from_list(lambda x: to_class(SlashCommandSelectSubcommandOption, x), self.options) result["title"] = from_str(self.title) if self.runtime_settings_changed is not None: result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskAgentProgress: """Schema for the `TaskAgentProgress` type.""" recent_activity: list[TaskProgressLine] """Recent tool execution events converted to display lines""" type: TaskAgentInfoType """Progress kind""" latest_intent: str | None = None """The most recent intent reported by the agent""" @staticmethod def from_dict(obj: Any) -> 'TaskAgentProgress': assert isinstance(obj, dict) recent_activity = from_list(TaskProgressLine.from_dict, obj.get("recentActivity")) type = TaskAgentInfoType(obj.get("type")) latest_intent = from_union([from_str, from_none], obj.get("latestIntent")) return TaskAgentProgress(recent_activity, type, latest_intent) def to_dict(self) -> dict: result: dict = {} result["recentActivity"] = from_list(lambda x: to_class(TaskProgressLine, x), self.recent_activity) result["type"] = to_enum(TaskAgentInfoType, self.type) if self.latest_intent is not None: result["latestIntent"] = from_union([from_str, from_none], self.latest_intent) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskShellInfo: """Schema for the `TaskShellInfo` type.""" attachment_mode: TaskShellInfoAttachmentMode """Whether the shell runs inside a managed PTY session or as an independent background process """ command: str """Command being executed""" description: str """Short description of the task""" id: str """Unique task identifier""" started_at: datetime """ISO 8601 timestamp when the task was started""" status: TaskStatus """Current lifecycle status of the task""" type: ClassVar[str] = "shell" """Task kind""" can_promote_to_background: bool | None = None """Whether this shell task can be promoted to background mode""" completed_at: datetime | None = None """ISO 8601 timestamp when the task finished""" execution_mode: TaskExecutionMode | None = None """Whether task execution is synchronously awaited or managed in the background""" log_path: str | None = None """Path to the detached shell log, when available""" pid: int | None = None """Process ID when available""" @staticmethod def from_dict(obj: Any) -> 'TaskShellInfo': assert isinstance(obj, dict) attachment_mode = TaskShellInfoAttachmentMode(obj.get("attachmentMode")) command = from_str(obj.get("command")) description = from_str(obj.get("description")) id = from_str(obj.get("id")) started_at = from_datetime(obj.get("startedAt")) status = TaskStatus(obj.get("status")) can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) execution_mode = from_union([TaskExecutionMode, from_none], obj.get("executionMode")) log_path = from_union([from_str, from_none], obj.get("logPath")) pid = from_union([from_int, from_none], obj.get("pid")) return TaskShellInfo(attachment_mode, command, description, id, started_at, status, can_promote_to_background, completed_at, execution_mode, log_path, pid) def to_dict(self) -> dict: result: dict = {} result["attachmentMode"] = to_enum(TaskShellInfoAttachmentMode, self.attachment_mode) result["command"] = from_str(self.command) result["description"] = from_str(self.description) result["id"] = from_str(self.id) result["startedAt"] = self.started_at.isoformat() result["status"] = to_enum(TaskStatus, self.status) result["type"] = self.type if self.can_promote_to_background is not None: result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) if self.completed_at is not None: result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) if self.execution_mode is not None: result["executionMode"] = from_union([lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode) if self.log_path is not None: result["logPath"] = from_union([from_str, from_none], self.log_path) if self.pid is not None: result["pid"] = from_union([from_int, from_none], self.pid) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskShellProgress: """Schema for the `TaskShellProgress` type.""" recent_output: str """Recent stdout/stderr lines from the running shell command""" type: TaskShellInfoType """Progress kind""" pid: int | None = None """Process ID when available""" @staticmethod def from_dict(obj: Any) -> 'TaskShellProgress': assert isinstance(obj, dict) recent_output = from_str(obj.get("recentOutput")) type = TaskShellInfoType(obj.get("type")) pid = from_union([from_int, from_none], obj.get("pid")) return TaskShellProgress(recent_output, type, pid) def to_dict(self) -> dict: result: dict = {} result["recentOutput"] = from_str(self.recent_output) result["type"] = to_enum(TaskShellInfoType, self.type) if self.pid is not None: result["pid"] = from_union([from_int, from_none], self.pid) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsCallToolRequest: """MCP server, tool name, and arguments to invoke from an MCP App view.""" origin_server_name: str """**Required.** Server whose ui:// view issued the request. Per SEP-1865 ('callable by the app from this server only'), the call is rejected when this differs from `serverName`, and rejected outright when missing. """ server_name: str """MCP server hosting the tool""" tool_name: str """MCP tool name""" arguments: dict[str, Any] | None = None """Tool arguments""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsCallToolRequest': assert isinstance(obj, dict) origin_server_name = from_str(obj.get("originServerName")) server_name = from_str(obj.get("serverName")) tool_name = from_str(obj.get("toolName")) arguments = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("arguments")) return MCPAppsCallToolRequest(origin_server_name, server_name, tool_name, arguments) def to_dict(self) -> dict: result: dict = {} result["originServerName"] = from_str(self.origin_server_name) result["serverName"] = from_str(self.server_name) result["toolName"] = from_str(self.tool_name) if self.arguments is not None: result["arguments"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.arguments) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPTools: """Schema for the `McpTools` type.""" name: str """Tool name.""" description: str | None = None """Tool description, when provided.""" @staticmethod def from_dict(obj: Any) -> 'MCPTools': assert isinstance(obj, dict) name = from_str(obj.get("name")) description = from_union([from_str, from_none], obj.get("description")) return MCPTools(name, description) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationAddToolApprovalParams: """Location-scoped tool approval to persist.""" approval: PermissionsLocationsAddToolApprovalDetails """Tool approval to persist and apply""" location_key: str """Location key (git root or cwd) to persist the approval to""" @staticmethod def from_dict(obj: Any) -> 'PermissionLocationAddToolApprovalParams': assert isinstance(obj, dict) approval = _load_PermissionsLocationsAddToolApprovalDetails(obj.get("approval")) location_key = from_str(obj.get("locationKey")) return PermissionLocationAddToolApprovalParams(approval, location_key) def to_dict(self) -> dict: result: dict = {} result["approval"] = (self.approval).to_dict() result["locationKey"] = from_str(self.location_key) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskAgentInfo: """Schema for the `TaskAgentInfo` type.""" agent_type: str """Type of agent running this task""" description: str """Short description of the task""" id: str """Unique task identifier""" prompt: str """Most recent prompt delivered to the agent. Updated whenever the agent receives a follow-up message. """ started_at: datetime """ISO 8601 timestamp when the task was started""" status: TaskStatus """Current lifecycle status of the task""" tool_call_id: str """Tool call ID associated with this agent task""" type: ClassVar[str] = "agent" """Task kind""" active_started_at: datetime | None = None """ISO 8601 timestamp when the current active period began""" active_time_ms: int | None = None """Accumulated active execution time in milliseconds""" can_promote_to_background: bool | None = None """Whether the task is currently in the original sync wait and can be moved to background mode. False once it is already backgrounded, idle, finished, or no longer has a promotable sync waiter. """ completed_at: datetime | None = None """ISO 8601 timestamp when the task finished""" error: str | None = None """Error message when the task failed""" execution_mode: TaskExecutionMode | None = None """Whether task execution is synchronously awaited or managed in the background""" idle_since: datetime | None = None """ISO 8601 timestamp when the agent entered idle state""" latest_response: str | None = None """Most recent response text from the agent""" model: str | None = None """Requested model override for the task when specified""" resolved_model: str | None = None """Runtime model resolved for the task when available""" result: str | None = None """Result text from the task when available""" @staticmethod def from_dict(obj: Any) -> 'TaskAgentInfo': assert isinstance(obj, dict) agent_type = from_str(obj.get("agentType")) description = from_str(obj.get("description")) id = from_str(obj.get("id")) prompt = from_str(obj.get("prompt")) started_at = from_datetime(obj.get("startedAt")) status = TaskStatus(obj.get("status")) tool_call_id = from_str(obj.get("toolCallId")) active_started_at = from_union([from_datetime, from_none], obj.get("activeStartedAt")) active_time_ms = from_union([from_int, from_none], obj.get("activeTimeMs")) can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) error = from_union([from_str, from_none], obj.get("error")) execution_mode = from_union([TaskExecutionMode, from_none], obj.get("executionMode")) idle_since = from_union([from_datetime, from_none], obj.get("idleSince")) latest_response = from_union([from_str, from_none], obj.get("latestResponse")) model = from_union([from_str, from_none], obj.get("model")) resolved_model = from_union([from_str, from_none], obj.get("resolvedModel")) result = from_union([from_str, from_none], obj.get("result")) return TaskAgentInfo(agent_type, description, id, prompt, started_at, status, tool_call_id, active_started_at, active_time_ms, can_promote_to_background, completed_at, error, execution_mode, idle_since, latest_response, model, resolved_model, result) def to_dict(self) -> dict: result: dict = {} result["agentType"] = from_str(self.agent_type) result["description"] = from_str(self.description) result["id"] = from_str(self.id) result["prompt"] = from_str(self.prompt) result["startedAt"] = self.started_at.isoformat() result["status"] = to_enum(TaskStatus, self.status) result["toolCallId"] = from_str(self.tool_call_id) result["type"] = self.type if self.active_started_at is not None: result["activeStartedAt"] = from_union([lambda x: x.isoformat(), from_none], self.active_started_at) if self.active_time_ms is not None: result["activeTimeMs"] = from_union([from_int, from_none], self.active_time_ms) if self.can_promote_to_background is not None: result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) if self.completed_at is not None: result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.execution_mode is not None: result["executionMode"] = from_union([lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode) if self.idle_since is not None: result["idleSince"] = from_union([lambda x: x.isoformat(), from_none], self.idle_since) if self.latest_response is not None: result["latestResponse"] = from_union([from_str, from_none], self.latest_response) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.resolved_model is not None: result["resolvedModel"] = from_union([from_str, from_none], self.resolved_model) if self.result is not None: result["result"] = from_union([from_str, from_none], self.result) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ToolList: """Built-in tools available for the requested model, with their parameters and instructions.""" tools: list[Tool] """List of available built-in tools with metadata""" @staticmethod def from_dict(obj: Any) -> 'ToolList': assert isinstance(obj, dict) tools = from_list(Tool.from_dict, obj.get("tools")) return ToolList(tools) def to_dict(self) -> dict: result: dict = {} result["tools"] = from_list(lambda x: to_class(Tool, x), self.tools) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserRequestedShellCommandResult: """Result of a user-requested shell command.""" output: str """Captured command output""" success: bool """Whether the command completed successfully""" tool_call_id: str """Tool call id emitted for the shell execution""" error: str | None = None """Error output when the execution failed""" exit_code: int | None = None """Process exit code, when available""" @staticmethod def from_dict(obj: Any) -> 'UserRequestedShellCommandResult': assert isinstance(obj, dict) output = from_str(obj.get("output")) success = from_bool(obj.get("success")) tool_call_id = from_str(obj.get("toolCallId")) error = from_union([from_str, from_none], obj.get("error")) exit_code = from_union([from_int, from_none], obj.get("exitCode")) return UserRequestedShellCommandResult(output, success, tool_call_id, error, exit_code) def to_dict(self) -> dict: result: dict = {} result["output"] = from_str(self.output) result["success"] = from_bool(self.success) result["toolCallId"] = from_str(self.tool_call_id) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.exit_code is not None: result["exitCode"] = from_union([from_int, from_none], self.exit_code) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingAutoModeSwitchRequest: """Request ID of a pending `auto_mode_switch.requested` event and the user's response.""" request_id: str """The unique request ID from the auto_mode_switch.requested event""" response: UIAutoModeSwitchResponse """User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). """ @staticmethod def from_dict(obj: Any) -> 'UIHandlePendingAutoModeSwitchRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIAutoModeSwitchResponse(obj.get("response")) return UIHandlePendingAutoModeSwitchRequest(request_id, response) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["response"] = to_enum(UIAutoModeSwitchResponse, self.response) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfFieldItems: """Schema applied to each item in the array.""" any_of: list[UIElicitationArrayAnyOfFieldItemsAnyOf] """Selectable options, each with a value and a display label.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfFieldItems': assert isinstance(obj, dict) any_of = from_list(UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict, obj.get("anyOf")) return UIElicitationArrayAnyOfFieldItems(any_of) def to_dict(self) -> dict: result: dict = {} result["anyOf"] = from_list(lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), self.any_of) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayEnumFieldItems: """Schema applied to each item in the array.""" enum: list[str] """Allowed string values for each selected item.""" type: UIElicitationArrayEnumFieldItemsType """Type discriminator. Always "string".""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationArrayEnumFieldItems': assert isinstance(obj, dict) enum = from_list(from_str, obj.get("enum")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) return UIElicitationArrayEnumFieldItems(enum, type) def to_dict(self) -> dict: result: dict = {} result["enum"] = from_list(from_str, self.enum) result["type"] = to_enum(UIElicitationArrayEnumFieldItemsType, self.type) return result @dataclass class UIElicitationArrayFieldItems: """Schema applied to each item in the array.""" enum: list[str] | None = None """Allowed string values for each selected item.""" type: UIElicitationArrayEnumFieldItemsType | None = None """Type discriminator. Always "string".""" any_of: list[UIElicitationArrayAnyOfFieldItemsAnyOf] | None = None """Selectable options, each with a value and a display label.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationArrayFieldItems': assert isinstance(obj, dict) enum = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enum")) type = from_union([UIElicitationArrayEnumFieldItemsType, from_none], obj.get("type")) any_of = from_union([lambda x: from_list(UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict, x), from_none], obj.get("anyOf")) return UIElicitationArrayFieldItems(enum, type, any_of) def to_dict(self) -> dict: result: dict = {} if self.enum is not None: result["enum"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum) if self.type is not None: result["type"] = from_union([lambda x: to_enum(UIElicitationArrayEnumFieldItemsType, x), from_none], self.type) if self.any_of is not None: result["anyOf"] = from_union([lambda x: from_list(lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), x), from_none], self.any_of) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringEnumField: """Single-select string field whose allowed values are defined inline.""" enum: list[str] """Allowed string values.""" type: UIElicitationArrayEnumFieldItemsType """Type discriminator. Always "string".""" default: str | None = None """Default value selected when the form is first shown.""" description: str | None = None """Help text describing the field.""" enum_names: list[str] | None = None """Optional display labels for each enum value, in the same order as `enum`.""" title: str | None = None """Human-readable label for the field.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationStringEnumField': assert isinstance(obj, dict) enum = from_list(from_str, obj.get("enum")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) default = from_union([from_str, from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) enum_names = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enumNames")) title = from_union([from_str, from_none], obj.get("title")) return UIElicitationStringEnumField(enum, type, default, description, enum_names, title) def to_dict(self) -> dict: result: dict = {} result["enum"] = from_list(from_str, self.enum) result["type"] = to_enum(UIElicitationArrayEnumFieldItemsType, self.type) if self.default is not None: result["default"] = from_union([from_str, from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.enum_names is not None: result["enumNames"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum_names) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyString: """Free-text string field with optional length and format constraints.""" type: UIElicitationArrayEnumFieldItemsType """Type discriminator. Always "string".""" default: str | None = None """Default value populated in the input when the form is first shown.""" description: str | None = None """Help text describing the field.""" format: UIElicitationSchemaPropertyStringFormat | None = None """Optional format hint that constrains the accepted input.""" max_length: int | None = None """Maximum number of characters allowed.""" min_length: int | None = None """Minimum number of characters required.""" title: str | None = None """Human-readable label for the field.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyString': assert isinstance(obj, dict) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) default = from_union([from_str, from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) format = from_union([UIElicitationSchemaPropertyStringFormat, from_none], obj.get("format")) max_length = from_union([from_int, from_none], obj.get("maxLength")) min_length = from_union([from_int, from_none], obj.get("minLength")) title = from_union([from_str, from_none], obj.get("title")) return UIElicitationSchemaPropertyString(type, default, description, format, max_length, min_length, title) def to_dict(self) -> dict: result: dict = {} result["type"] = to_enum(UIElicitationArrayEnumFieldItemsType, self.type) if self.default is not None: result["default"] = from_union([from_str, from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.format is not None: result["format"] = from_union([lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], self.format) if self.max_length is not None: result["maxLength"] = from_union([from_int, from_none], self.max_length) if self.min_length is not None: result["minLength"] = from_union([from_int, from_none], self.min_length) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringOneOfField: """Single-select string field where each option pairs a value with a display label.""" one_of: list[UIElicitationStringOneOfFieldOneOf] """Selectable options, each with a value and a display label.""" type: UIElicitationArrayEnumFieldItemsType """Type discriminator. Always "string".""" default: str | None = None """Default value selected when the form is first shown.""" description: str | None = None """Help text describing the field.""" title: str | None = None """Human-readable label for the field.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationStringOneOfField': assert isinstance(obj, dict) one_of = from_list(UIElicitationStringOneOfFieldOneOf.from_dict, obj.get("oneOf")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) default = from_union([from_str, from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) title = from_union([from_str, from_none], obj.get("title")) return UIElicitationStringOneOfField(one_of, type, default, description, title) def to_dict(self) -> dict: result: dict = {} result["oneOf"] = from_list(lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), self.one_of) result["type"] = to_enum(UIElicitationArrayEnumFieldItemsType, self.type) if self.default is not None: result["default"] = from_union([from_str, from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationResponse: """The elicitation response (accept with form values, decline, or cancel)""" action: UIElicitationResponseAction """The user's response: accept (submitted), decline (rejected), or cancel (dismissed)""" content: dict[str, float | bool | list[str] | str] | None = None """The form values submitted by the user (present when action is 'accept')""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationResponse': assert isinstance(obj, dict) action = UIElicitationResponseAction(obj.get("action")) content = from_union([lambda x: from_dict(lambda x: from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], x), x), from_none], obj.get("content")) return UIElicitationResponse(action, content) def to_dict(self) -> dict: result: dict = {} result["action"] = to_enum(UIElicitationResponseAction, self.action) if self.content is not None: result["content"] = from_union([lambda x: from_dict(lambda x: from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], x), x), from_none], self.content) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyBoolean: """Boolean field rendered as a yes/no toggle.""" type: UIElicitationSchemaPropertyBooleanType """Type discriminator. Always "boolean".""" default: bool | None = None """Default value selected when the form is first shown.""" description: str | None = None """Help text describing the field.""" title: str | None = None """Human-readable label for the field.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyBoolean': assert isinstance(obj, dict) type = UIElicitationSchemaPropertyBooleanType(obj.get("type")) default = from_union([from_bool, from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) title = from_union([from_str, from_none], obj.get("title")) return UIElicitationSchemaPropertyBoolean(type, default, description, title) def to_dict(self) -> dict: result: dict = {} result["type"] = to_enum(UIElicitationSchemaPropertyBooleanType, self.type) if self.default is not None: result["default"] = from_union([from_bool, from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyNumber: """Numeric field accepting either a number or an integer.""" type: UIElicitationSchemaPropertyNumberType """Numeric type accepted by the field.""" default: float | None = None """Default value populated in the input when the form is first shown.""" description: str | None = None """Help text describing the field.""" maximum: float | None = None """Maximum allowed value (inclusive).""" minimum: float | None = None """Minimum allowed value (inclusive).""" title: str | None = None """Human-readable label for the field.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyNumber': assert isinstance(obj, dict) type = UIElicitationSchemaPropertyNumberType(obj.get("type")) default = from_union([from_float, from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) maximum = from_union([from_float, from_none], obj.get("maximum")) minimum = from_union([from_float, from_none], obj.get("minimum")) title = from_union([from_str, from_none], obj.get("title")) return UIElicitationSchemaPropertyNumber(type, default, description, maximum, minimum, title) def to_dict(self) -> dict: result: dict = {} result["type"] = to_enum(UIElicitationSchemaPropertyNumberType, self.type) if self.default is not None: result["default"] = from_union([to_float, from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.maximum is not None: result["maximum"] = from_union([to_float, from_none], self.maximum) if self.minimum is not None: result["minimum"] = from_union([to_float, from_none], self.minimum) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIExitPlanModeResponse: """Schema for the `UIExitPlanModeResponse` type.""" approved: bool """Whether the plan was approved.""" auto_approve_edits: bool | None = None """Whether subsequent edits should be auto-approved without confirmation.""" feedback: str | None = None """Feedback from the user when they declined the plan or requested changes.""" selected_action: UIExitPlanModeAction | None = None """The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. """ @staticmethod def from_dict(obj: Any) -> 'UIExitPlanModeResponse': assert isinstance(obj, dict) approved = from_bool(obj.get("approved")) auto_approve_edits = from_union([from_bool, from_none], obj.get("autoApproveEdits")) feedback = from_union([from_str, from_none], obj.get("feedback")) selected_action = from_union([UIExitPlanModeAction, from_none], obj.get("selectedAction")) return UIExitPlanModeResponse(approved, auto_approve_edits, feedback, selected_action) def to_dict(self) -> dict: result: dict = {} result["approved"] = from_bool(self.approved) if self.auto_approve_edits is not None: result["autoApproveEdits"] = from_union([from_bool, from_none], self.auto_approve_edits) if self.feedback is not None: result["feedback"] = from_union([from_str, from_none], self.feedback) if self.selected_action is not None: result["selectedAction"] = from_union([lambda x: to_enum(UIExitPlanModeAction, x), from_none], self.selected_action) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UISessionLimitsExhaustedResponse: """The selected session-limit action. The user's selected action for an exhausted session limit. """ action: UISessionLimitsExhaustedResponseAction """Action selected by the user.""" additional_ai_credits: float | None = None """AI Credits to add to the current max when action is 'add'.""" max_ai_credits: float | None = None """New absolute max AI Credits when action is 'set'.""" @staticmethod def from_dict(obj: Any) -> 'UISessionLimitsExhaustedResponse': assert isinstance(obj, dict) action = UISessionLimitsExhaustedResponseAction(obj.get("action")) additional_ai_credits = from_union([from_float, from_none], obj.get("additionalAiCredits")) max_ai_credits = from_union([from_float, from_none], obj.get("maxAiCredits")) return UISessionLimitsExhaustedResponse(action, additional_ai_credits, max_ai_credits) def to_dict(self) -> dict: result: dict = {} result["action"] = to_enum(UISessionLimitsExhaustedResponseAction, self.action) if self.additional_ai_credits is not None: result["additionalAiCredits"] = from_union([to_float, from_none], self.additional_ai_credits) if self.max_ai_credits is not None: result["maxAiCredits"] = from_union([to_float, from_none], self.max_ai_credits) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingUserInputRequest: """Request ID of a pending `user_input.requested` event and the user's response.""" request_id: str """The unique request ID from the user_input.requested event""" response: UIUserInputResponse """Schema for the `UIUserInputResponse` type.""" @staticmethod def from_dict(obj: Any) -> 'UIHandlePendingUserInputRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIUserInputResponse.from_dict(obj.get("response")) return UIHandlePendingUserInputRequest(request_id, response) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["response"] = to_class(UIUserInputResponse, self.response) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetric: """Schema for the `UsageMetricsModelMetric` type.""" requests: UsageMetricsModelMetricRequests """Request count and cost metrics for this model""" usage: UsageMetricsModelMetricUsage """Token usage metrics for this model""" token_details: dict[str, UsageMetricsModelMetricTokenDetail] | None = None """Token count details per type""" total_nano_aiu: float | None = None """Accumulated nano-AI units cost for this model""" @staticmethod def from_dict(obj: Any) -> 'UsageMetricsModelMetric': assert isinstance(obj, dict) requests = UsageMetricsModelMetricRequests.from_dict(obj.get("requests")) usage = UsageMetricsModelMetricUsage.from_dict(obj.get("usage")) token_details = from_union([lambda x: from_dict(UsageMetricsModelMetricTokenDetail.from_dict, x), from_none], obj.get("tokenDetails")) total_nano_aiu = from_union([from_float, from_none], obj.get("totalNanoAiu")) return UsageMetricsModelMetric(requests, usage, token_details, total_nano_aiu) def to_dict(self) -> dict: result: dict = {} result["requests"] = to_class(UsageMetricsModelMetricRequests, self.requests) result["usage"] = to_class(UsageMetricsModelMetricUsage, self.usage) if self.token_details is not None: result["tokenDetails"] = from_union([lambda x: from_dict(lambda x: to_class(UsageMetricsModelMetricTokenDetail, x), x), from_none], self.token_details) if self.total_nano_aiu is not None: result["totalNanoAiu"] = from_union([to_float, from_none], self.total_nano_aiu) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserSettingsGetResult: """Per-key metadata for every known user setting (settings.json overlaid with the legacy config.json, config.json wins), including settings left at their default. Excludes repository- and enterprise-managed overrides. """ settings: dict[str, UserSettingMetadata] """Every known user setting keyed by setting name, each with its effective value, default, and whether it is at the default. """ @staticmethod def from_dict(obj: Any) -> 'UserSettingsGetResult': assert isinstance(obj, dict) settings = from_dict(UserSettingMetadata.from_dict, obj.get("settings")) return UserSettingsGetResult(settings) def to_dict(self) -> dict: result: dict = {} result["settings"] = from_dict(lambda x: to_class(UserSettingMetadata, x), self.settings) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceDiffFileChange: """A single changed file and its unified diff.""" change_type: WorkspaceDiffFileChangeType """Type of change represented by this file diff.""" diff: str """Unified diff content for the file. Empty when the diff was truncated.""" path: str """Path to the changed file, relative to the workspace root.""" is_truncated: bool | None = None """Whether the diff content was omitted because it exceeded the per-file size limit.""" old_path: str | None = None """Original file path for renamed files.""" @staticmethod def from_dict(obj: Any) -> 'WorkspaceDiffFileChange': assert isinstance(obj, dict) change_type = WorkspaceDiffFileChangeType(obj.get("changeType")) diff = from_str(obj.get("diff")) path = from_str(obj.get("path")) is_truncated = from_union([from_bool, from_none], obj.get("isTruncated")) old_path = from_union([from_str, from_none], obj.get("oldPath")) return WorkspaceDiffFileChange(change_type, diff, path, is_truncated, old_path) def to_dict(self) -> dict: result: dict = {} result["changeType"] = to_enum(WorkspaceDiffFileChangeType, self.change_type) result["diff"] = from_str(self.diff) result["path"] = from_str(self.path) if self.is_truncated is not None: result["isTruncated"] = from_union([from_bool, from_none], self.is_truncated) if self.old_path is not None: result["oldPath"] = from_union([from_str, from_none], self.old_path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesDiffRequest: """Parameters for computing a workspace diff.""" mode: WorkspaceDiffMode """Diff mode requested by the client.""" ignore_whitespace: bool | None = None """When true, ignore whitespace-only changes (git `--ignore-all-space`). Defaults to false.""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesDiffRequest': assert isinstance(obj, dict) mode = WorkspaceDiffMode(obj.get("mode")) ignore_whitespace = from_union([from_bool, from_none], obj.get("ignoreWhitespace")) return WorkspacesDiffRequest(mode, ignore_whitespace) def to_dict(self) -> dict: result: dict = {} result["mode"] = to_enum(WorkspaceDiffMode, self.mode) if self.ignore_whitespace is not None: result["ignoreWhitespace"] = from_union([from_bool, from_none], self.ignore_whitespace) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesSaveLargePasteResult: """Descriptor for the saved paste file, or null when the workspace is unavailable.""" saved: Saved | None = None """Saved-paste descriptor, or null when the workspace is unavailable (e.g. CCA runtime, non-infinite sessions, remote sessions) """ @staticmethod def from_dict(obj: Any) -> 'WorkspacesSaveLargePasteResult': assert isinstance(obj, dict) saved = from_union([Saved.from_dict, from_none], obj.get("saved")) return WorkspacesSaveLargePasteResult(saved) def to_dict(self) -> dict: result: dict = {} result["saved"] = from_union([lambda x: to_class(Saved, x), from_none], self.saved) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentDiscoveryPathList: """Canonical locations where custom agents can be created so the runtime will recognize them.""" paths: list[AgentDiscoveryPath] """Canonical agent create/discovery directories, in priority order""" @staticmethod def from_dict(obj: Any) -> 'AgentDiscoveryPathList': assert isinstance(obj, dict) paths = from_list(AgentDiscoveryPath.from_dict, obj.get("paths")) return AgentDiscoveryPathList(paths) def to_dict(self) -> dict: result: dict = {} result["paths"] = from_list(lambda x: to_class(AgentDiscoveryPath, x), self.paths) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentRegistrySpawnRegistryTimeout: """Spawn succeeded but the child did not publish a matching managed-server entry within the timeout. """ child_pid: int """Process ID of the orphaned child (so the caller can offer 'kill the pid' guidance)""" kind: ClassVar[str] = "registry-timeout" """Discriminator: spawn succeeded but child never registered""" log_capture: AgentRegistryLogCapture | None = None """Per-spawn log-capture outcome; populated from spawnLiveTarget.""" @staticmethod def from_dict(obj: Any) -> 'AgentRegistrySpawnRegistryTimeout': assert isinstance(obj, dict) child_pid = from_int(obj.get("childPid")) log_capture = from_union([AgentRegistryLogCapture.from_dict, from_none], obj.get("logCapture")) return AgentRegistrySpawnRegistryTimeout(child_pid, log_capture) def to_dict(self) -> dict: result: dict = {} result["childPid"] = from_int(self.child_pid) result["kind"] = self.kind if self.log_capture is not None: result["logCapture"] = from_union([lambda x: to_class(AgentRegistryLogCapture, x), from_none], self.log_capture) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasList: """Declared canvases available in this session.""" canvases: list[DiscoveredCanvas] """Declared canvases available in this session""" @staticmethod def from_dict(obj: Any) -> 'CanvasList': assert isinstance(obj, dict) canvases = from_list(DiscoveredCanvas.from_dict, obj.get("canvases")) return CanvasList(canvases) def to_dict(self) -> dict: result: dict = {} result["canvases"] = from_list(lambda x: to_class(DiscoveredCanvas, x), self.canvases) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInfo: """Schema for the `SlashCommandInfo` type.""" allow_during_agent_execution: bool """Whether the command may run while an agent turn is active""" description: str """Human-readable command description""" kind: SlashCommandKind """Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command """ name: str """Canonical command name without a leading slash""" aliases: list[str] | None = None """Canonical aliases without leading slashes""" experimental: bool | None = None """Whether the command is experimental""" input: SlashCommandInput | None = None """Optional unstructured input hint""" schedulable: bool | None = None """Whether the command may be the target of `/every` / `/after` schedules. Resolution happens at every tick, so only set this when the command is safe to re-invoke and produces an agent prompt. """ @staticmethod def from_dict(obj: Any) -> 'SlashCommandInfo': assert isinstance(obj, dict) allow_during_agent_execution = from_bool(obj.get("allowDuringAgentExecution")) description = from_str(obj.get("description")) kind = SlashCommandKind(obj.get("kind")) name = from_str(obj.get("name")) aliases = from_union([lambda x: from_list(from_str, x), from_none], obj.get("aliases")) experimental = from_union([from_bool, from_none], obj.get("experimental")) input = from_union([SlashCommandInput.from_dict, from_none], obj.get("input")) schedulable = from_union([from_bool, from_none], obj.get("schedulable")) return SlashCommandInfo(allow_during_agent_execution, description, kind, name, aliases, experimental, input, schedulable) def to_dict(self) -> dict: result: dict = {} result["allowDuringAgentExecution"] = from_bool(self.allow_during_agent_execution) result["description"] = from_str(self.description) result["kind"] = to_enum(SlashCommandKind, self.kind) result["name"] = from_str(self.name) if self.aliases is not None: result["aliases"] = from_union([lambda x: from_list(from_str, x), from_none], self.aliases) if self.experimental is not None: result["experimental"] = from_union([from_bool, from_none], self.experimental) if self.input is not None: result["input"] = from_union([lambda x: to_class(SlashCommandInput, x), from_none], self.input) if self.schedulable is not None: result["schedulable"] = from_union([from_bool, from_none], self.schedulable) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteSessionConnectionResult: """Remote session connection result.""" metadata: ConnectedRemoteSessionMetadata """Metadata for a connected remote session.""" session_id: str """SDK session ID for the connected remote session.""" @staticmethod def from_dict(obj: Any) -> 'RemoteSessionConnectionResult': assert isinstance(obj, dict) metadata = ConnectedRemoteSessionMetadata.from_dict(obj.get("metadata")) session_id = from_str(obj.get("sessionId")) return RemoteSessionConnectionResult(metadata, session_id) def to_dict(self) -> dict: result: dict = {} result["metadata"] = to_class(ConnectedRemoteSessionMetadata, self.metadata) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasHostContext: """Host context supplied by the runtime.""" capabilities: CanvasHostContextCapabilities | None = None """Host capabilities""" @staticmethod def from_dict(obj: Any) -> 'CanvasHostContext': assert isinstance(obj, dict) capabilities = from_union([CanvasHostContextCapabilities.from_dict, from_none], obj.get("capabilities")) return CanvasHostContext(capabilities) def to_dict(self) -> dict: result: dict = {} if self.capabilities is not None: result["capabilities"] = from_union([lambda x: to_class(CanvasHostContextCapabilities, x), from_none], self.capabilities) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponse: """Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ access_type_sku: str | None = None analytics_tracking_id: str | None = None assigned_date: Any = None can_signup_for_limited: bool | None = None can_upgrade_plan: bool | None = None chat_enabled: bool | None = None cli_remote_control_enabled: bool | None = None cloud_session_storage_enabled: bool | None = None codex_agent_enabled: bool | None = None copilot_plan: str | None = None copilotignore_enabled: bool | None = None endpoints: CopilotUserResponseEndpoints | None = None """Schema for the `CopilotUserResponseEndpoints` type.""" is_mcp_enabled: Any = None is_staff: bool | None = None limited_user_quotas: dict[str, float] | None = None limited_user_reset_date: str | None = None login: str | None = None monthly_quotas: dict[str, float] | None = None organization_list: Any = None organization_login_list: list[str] | None = None quota_reset_date: str | None = None quota_reset_date_utc: str | None = None quota_snapshots: dict[str, CopilotUserResponseQuotaSnapshots | None] | None = None """Schema for the `CopilotUserResponseQuotaSnapshots` type.""" restricted_telemetry: bool | None = None te: bool | None = None token_based_billing: bool | None = None @staticmethod def from_dict(obj: Any) -> 'CopilotUserResponse': assert isinstance(obj, dict) access_type_sku = from_union([from_str, from_none], obj.get("access_type_sku")) analytics_tracking_id = from_union([from_str, from_none], obj.get("analytics_tracking_id")) assigned_date = obj.get("assigned_date") can_signup_for_limited = from_union([from_bool, from_none], obj.get("can_signup_for_limited")) can_upgrade_plan = from_union([from_bool, from_none], obj.get("can_upgrade_plan")) chat_enabled = from_union([from_bool, from_none], obj.get("chat_enabled")) cli_remote_control_enabled = from_union([from_bool, from_none], obj.get("cli_remote_control_enabled")) cloud_session_storage_enabled = from_union([from_bool, from_none], obj.get("cloud_session_storage_enabled")) codex_agent_enabled = from_union([from_bool, from_none], obj.get("codex_agent_enabled")) copilot_plan = from_union([from_str, from_none], obj.get("copilot_plan")) copilotignore_enabled = from_union([from_bool, from_none], obj.get("copilotignore_enabled")) endpoints = from_union([CopilotUserResponseEndpoints.from_dict, from_none], obj.get("endpoints")) is_mcp_enabled = obj.get("is_mcp_enabled") is_staff = from_union([from_bool, from_none], obj.get("is_staff")) limited_user_quotas = from_union([lambda x: from_dict(from_float, x), from_none], obj.get("limited_user_quotas")) limited_user_reset_date = from_union([from_str, from_none], obj.get("limited_user_reset_date")) login = from_union([from_str, from_none], obj.get("login")) monthly_quotas = from_union([lambda x: from_dict(from_float, x), from_none], obj.get("monthly_quotas")) organization_list = obj.get("organization_list") organization_login_list = from_union([lambda x: from_list(from_str, x), from_none], obj.get("organization_login_list")) quota_reset_date = from_union([from_str, from_none], obj.get("quota_reset_date")) quota_reset_date_utc = from_union([from_str, from_none], obj.get("quota_reset_date_utc")) quota_snapshots = from_union([lambda x: from_dict(lambda x: from_union([CopilotUserResponseQuotaSnapshots.from_dict, from_none], x), x), from_none], obj.get("quota_snapshots")) restricted_telemetry = from_union([from_bool, from_none], obj.get("restricted_telemetry")) te = from_union([from_bool, from_none], obj.get("te")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) return CopilotUserResponse(access_type_sku, analytics_tracking_id, assigned_date, can_signup_for_limited, can_upgrade_plan, chat_enabled, cli_remote_control_enabled, cloud_session_storage_enabled, codex_agent_enabled, copilot_plan, copilotignore_enabled, endpoints, is_mcp_enabled, is_staff, limited_user_quotas, limited_user_reset_date, login, monthly_quotas, organization_list, organization_login_list, quota_reset_date, quota_reset_date_utc, quota_snapshots, restricted_telemetry, te, token_based_billing) def to_dict(self) -> dict: result: dict = {} if self.access_type_sku is not None: result["access_type_sku"] = from_union([from_str, from_none], self.access_type_sku) if self.analytics_tracking_id is not None: result["analytics_tracking_id"] = from_union([from_str, from_none], self.analytics_tracking_id) if self.assigned_date is not None: result["assigned_date"] = self.assigned_date if self.can_signup_for_limited is not None: result["can_signup_for_limited"] = from_union([from_bool, from_none], self.can_signup_for_limited) if self.can_upgrade_plan is not None: result["can_upgrade_plan"] = from_union([from_bool, from_none], self.can_upgrade_plan) if self.chat_enabled is not None: result["chat_enabled"] = from_union([from_bool, from_none], self.chat_enabled) if self.cli_remote_control_enabled is not None: result["cli_remote_control_enabled"] = from_union([from_bool, from_none], self.cli_remote_control_enabled) if self.cloud_session_storage_enabled is not None: result["cloud_session_storage_enabled"] = from_union([from_bool, from_none], self.cloud_session_storage_enabled) if self.codex_agent_enabled is not None: result["codex_agent_enabled"] = from_union([from_bool, from_none], self.codex_agent_enabled) if self.copilot_plan is not None: result["copilot_plan"] = from_union([from_str, from_none], self.copilot_plan) if self.copilotignore_enabled is not None: result["copilotignore_enabled"] = from_union([from_bool, from_none], self.copilotignore_enabled) if self.endpoints is not None: result["endpoints"] = from_union([lambda x: to_class(CopilotUserResponseEndpoints, x), from_none], self.endpoints) if self.is_mcp_enabled is not None: result["is_mcp_enabled"] = self.is_mcp_enabled if self.is_staff is not None: result["is_staff"] = from_union([from_bool, from_none], self.is_staff) if self.limited_user_quotas is not None: result["limited_user_quotas"] = from_union([lambda x: from_dict(to_float, x), from_none], self.limited_user_quotas) if self.limited_user_reset_date is not None: result["limited_user_reset_date"] = from_union([from_str, from_none], self.limited_user_reset_date) if self.login is not None: result["login"] = from_union([from_str, from_none], self.login) if self.monthly_quotas is not None: result["monthly_quotas"] = from_union([lambda x: from_dict(to_float, x), from_none], self.monthly_quotas) if self.organization_list is not None: result["organization_list"] = self.organization_list if self.organization_login_list is not None: result["organization_login_list"] = from_union([lambda x: from_list(from_str, x), from_none], self.organization_login_list) if self.quota_reset_date is not None: result["quota_reset_date"] = from_union([from_str, from_none], self.quota_reset_date) if self.quota_reset_date_utc is not None: result["quota_reset_date_utc"] = from_union([from_str, from_none], self.quota_reset_date_utc) if self.quota_snapshots is not None: result["quota_snapshots"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x), x), from_none], self.quota_snapshots) if self.restricted_telemetry is not None: result["restricted_telemetry"] = from_union([from_bool, from_none], self.restricted_telemetry) if self.te is not None: result["te"] = from_union([from_bool, from_none], self.te) if self.token_based_billing is not None: result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionList: """Extensions discovered for the session, with their current status.""" extensions: list[Extension] """Discovered extensions and their current status""" @staticmethod def from_dict(obj: Any) -> 'ExtensionList': assert isinstance(obj, dict) extensions = from_list(Extension.from_dict, obj.get("extensions")) return ExtensionList(extensions) def to_dict(self) -> dict: result: dict = {} result["extensions"] = from_list(lambda x: to_class(Extension, x), self.extensions) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess: """Schema for the `PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess` type. """ extension_name: str """Extension name.""" kind: ClassVar[str] = "extension-permission-access" """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess': assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess(extension_name) def to_dict(self) -> dict: result: dict = {} result["extensionName"] = from_str(self.extension_name) result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess: """Schema for the `PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess` type. """ extension_name: str """Extension name.""" kind: ClassVar[str] = "extension-permission-access" """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess': assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess(extension_name) def to_dict(self) -> dict: result: dict = {} result["extensionName"] = from_str(self.extension_name) result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess: """Schema for the `PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess` type.""" extension_name: str """Extension name.""" kind: ClassVar[str] = "extension-permission-access" """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess': assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess(extension_name) def to_dict(self) -> dict: result: dict = {} result["extensionName"] = from_str(self.extension_name) result["kind"] = self.kind return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlm: """Expanded external tool result payload""" text_result_for_llm: str """Text result returned to the model""" binary_results_for_llm: list[ExternalToolTextResultForLlmBinaryResultsForLlm] | None = None """Base64-encoded binary results returned to the model""" contents: list[ExternalToolTextResultForLlmContent] | None = None """Structured content blocks from the tool""" error: str | None = None """Optional error message for failed executions""" result_type: str | None = None """Execution outcome classification. Optional for back-compat; normalized to 'success' (or 'failure' when error is present) when missing or unrecognized. """ session_log: str | None = None """Detailed log content for timeline display""" tool_telemetry: dict[str, Any] | None = None """Optional tool-specific telemetry""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlm': assert isinstance(obj, dict) text_result_for_llm = from_str(obj.get("textResultForLlm")) binary_results_for_llm = from_union([lambda x: from_list(ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict, x), from_none], obj.get("binaryResultsForLlm")) contents = from_union([lambda x: from_list(_load_ExternalToolTextResultForLlmContent, x), from_none], obj.get("contents")) error = from_union([from_str, from_none], obj.get("error")) result_type = from_union([from_str, from_none], obj.get("resultType")) session_log = from_union([from_str, from_none], obj.get("sessionLog")) tool_telemetry = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("toolTelemetry")) return ExternalToolTextResultForLlm(text_result_for_llm, binary_results_for_llm, contents, error, result_type, session_log, tool_telemetry) def to_dict(self) -> dict: result: dict = {} result["textResultForLlm"] = from_str(self.text_result_for_llm) if self.binary_results_for_llm is not None: result["binaryResultsForLlm"] = from_union([lambda x: from_list(lambda x: to_class(ExternalToolTextResultForLlmBinaryResultsForLlm, x), x), from_none], self.binary_results_for_llm) if self.contents is not None: result["contents"] = from_union([lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.contents) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result_type is not None: result["resultType"] = from_union([from_str, from_none], self.result_type) if self.session_log is not None: result["sessionLog"] = from_union([from_str, from_none], self.session_log) if self.tool_telemetry is not None: result["toolTelemetry"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.tool_telemetry) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResourceLink: """Resource link content block referencing an external resource""" name: str """Resource name identifier""" type: ClassVar[str] = "resource_link" """Content block type discriminator""" uri: str """URI identifying the resource""" description: str | None = None """Human-readable description of the resource""" icons: list[ExternalToolTextResultForLlmContentResourceLinkIcon] | None = None """Icons associated with this resource""" mime_type: str | None = None """MIME type of the resource content""" size: int | None = None """Size of the resource in bytes""" title: str | None = None """Human-readable display title for the resource""" @staticmethod def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResourceLink': assert isinstance(obj, dict) name = from_str(obj.get("name")) uri = from_str(obj.get("uri")) description = from_union([from_str, from_none], obj.get("description")) icons = from_union([lambda x: from_list(ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict, x), from_none], obj.get("icons")) mime_type = from_union([from_str, from_none], obj.get("mimeType")) size = from_union([from_int, from_none], obj.get("size")) title = from_union([from_str, from_none], obj.get("title")) return ExternalToolTextResultForLlmContentResourceLink(name, uri, description, icons, mime_type, size, title) def to_dict(self) -> dict: result: dict = {} result["name"] = from_str(self.name) result["type"] = self.type result["uri"] = from_str(self.uri) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.icons is not None: result["icons"] = from_union([lambda x: from_list(lambda x: to_class(ExternalToolTextResultForLlmContentResourceLinkIcon, x), x), from_none], self.icons) if self.mime_type is not None: result["mimeType"] = from_union([from_str, from_none], self.mime_type) if self.size is not None: result["size"] = from_union([from_int, from_none], self.size) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSource: """Schema for the `InstalledPluginSourceGitHub` type. Schema for the `InstalledPluginSourceUrl` type. Schema for the `InstalledPluginSourceLocal` type. """ source: PurpleSource """Constant value. Always "github". Constant value. Always "url". Constant value. Always "local". """ path: str | None = None ref: str | None = None repo: str | None = None url: str | None = None @staticmethod def from_dict(obj: Any) -> 'InstalledPluginSource': assert isinstance(obj, dict) source = PurpleSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) repo = from_union([from_str, from_none], obj.get("repo")) url = from_union([from_str, from_none], obj.get("url")) return InstalledPluginSource(source, path, ref, repo, url) def to_dict(self) -> dict: result: dict = {} result["source"] = to_enum(PurpleSource, self.source) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: result["ref"] = from_union([from_str, from_none], self.ref) if self.repo is not None: result["repo"] = from_union([from_str, from_none], self.repo) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSource: """Schema for the `SessionInstalledPluginSourceGitHub` type. Schema for the `SessionInstalledPluginSourceUrl` type. Schema for the `SessionInstalledPluginSourceLocal` type. """ source: PurpleSource """Constant value. Always "github". Constant value. Always "url". Constant value. Always "local". """ path: str | None = None ref: str | None = None repo: str | None = None url: str | None = None @staticmethod def from_dict(obj: Any) -> 'SessionInstalledPluginSource': assert isinstance(obj, dict) source = PurpleSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) repo = from_union([from_str, from_none], obj.get("repo")) url = from_union([from_str, from_none], obj.get("url")) return SessionInstalledPluginSource(source, path, ref, repo, url) def to_dict(self) -> dict: result: dict = {} result["source"] = to_enum(PurpleSource, self.source) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: result["ref"] = from_union([from_str, from_none], self.ref) if self.repo is not None: result["repo"] = from_union([from_str, from_none], self.repo) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionDiscoveryPathList: """Canonical files and directories where custom instructions can be created so the runtime will recognize them. """ paths: list[InstructionDiscoveryPath] """Canonical instruction create/discovery files and directories, in priority order""" @staticmethod def from_dict(obj: Any) -> 'InstructionDiscoveryPathList': assert isinstance(obj, dict) paths = from_list(InstructionDiscoveryPath.from_dict, obj.get("paths")) return InstructionDiscoveryPathList(paths) def to_dict(self) -> dict: result: dict = {} result["paths"] = from_list(lambda x: to_class(InstructionDiscoveryPath, x), self.paths) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionsGetSourcesResult: """Instruction sources loaded for the session, in merge order.""" sources: list[InstructionSource] """Instruction sources for the session""" @staticmethod def from_dict(obj: Any) -> 'InstructionsGetSourcesResult': assert isinstance(obj, dict) sources = from_list(InstructionSource.from_dict, obj.get("sources")) return InstructionsGetSourcesResult(sources) def to_dict(self) -> dict: result: dict = {} result["sources"] = from_list(lambda x: to_class(InstructionSource, x), self.sources) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ServerInstructionSourceList: """Instruction sources discovered across user, repository, and plugin sources.""" sources: list[InstructionSource] """All discovered instruction sources""" @staticmethod def from_dict(obj: Any) -> 'ServerInstructionSourceList': assert isinstance(obj, dict) sources = from_list(InstructionSource.from_dict, obj.get("sources")) return ServerInstructionSourceList(sources) def to_dict(self) -> dict: result: dict = {} result["sources"] = from_list(lambda x: to_class(InstructionSource, x), self.sources) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LocalSessionMetadataValue: """Schema for the `LocalSessionMetadataValue` type.""" is_remote: bool """Always false for local sessions.""" modified_time: str """Last-modified time of the session's persisted state, as ISO 8601""" session_id: str """Stable session identifier""" start_time: str """Session creation time as an ISO 8601 timestamp""" client_name: str | None = None """Runtime client name that created/last resumed this session""" context: SessionContext | None = None """Pre-resolved working-directory context for session startup.""" is_detached: bool | None = None """True for detached maintenance sessions that should be hidden from normal resume lists.""" mc_task_id: str | None = None """GitHub task ID, when this local session is bound to one. Only present for local sessions exported to remote control. """ name: str | None = None """Optional human-friendly name set via /rename""" summary: str | None = None """Short summary of the session, when one has been derived""" @staticmethod def from_dict(obj: Any) -> 'LocalSessionMetadataValue': assert isinstance(obj, dict) is_remote = from_bool(obj.get("isRemote")) modified_time = from_str(obj.get("modifiedTime")) session_id = from_str(obj.get("sessionId")) start_time = from_str(obj.get("startTime")) client_name = from_union([from_str, from_none], obj.get("clientName")) context = from_union([SessionContext.from_dict, from_none], obj.get("context")) is_detached = from_union([from_bool, from_none], obj.get("isDetached")) mc_task_id = from_union([from_str, from_none], obj.get("mcTaskId")) name = from_union([from_str, from_none], obj.get("name")) summary = from_union([from_str, from_none], obj.get("summary")) return LocalSessionMetadataValue(is_remote, modified_time, session_id, start_time, client_name, context, is_detached, mc_task_id, name, summary) def to_dict(self) -> dict: result: dict = {} result["isRemote"] = from_bool(self.is_remote) result["modifiedTime"] = from_str(self.modified_time) result["sessionId"] = from_str(self.session_id) result["startTime"] = from_str(self.start_time) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.context is not None: result["context"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.context) if self.is_detached is not None: result["isDetached"] = from_union([from_bool, from_none], self.is_detached) if self.mc_task_id is not None: result["mcTaskId"] = from_union([from_str, from_none], self.mc_task_id) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.summary is not None: result["summary"] = from_union([from_str, from_none], self.summary) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteSessionMetadataValue: """Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). Full remote-session metadata in wire-portable form. Remote session metadata, present when status is `connected`. """ is_remote: bool """Always true for remote sessions.""" modified_time: str """Last-modified time as an ISO 8601 timestamp.""" remote_session_ids: list[str] """Backing remote session IDs (most recent first).""" repository: RemoteSessionMetadataRepository """GitHub repository the remote session belongs to.""" session_id: str """Stable session identifier.""" start_time: str """Session creation time as an ISO 8601 timestamp.""" context: SessionContext | None = None """Most recent working directory context.""" name: str | None = None """Optional human-friendly name set via /rename.""" pull_request_number: int | None = None """Pull request number associated with the session.""" resource_id: str | None = None """Original remote resource identifier (task ID or PR node ID).""" stale_at: str | None = None """Deadline (ISO 8601) at which a CLI remote session becomes stale without further heartbeats. """ state: str | None = None """Server-side task state returned by GitHub.""" summary: str | None = None """Short summary of the session, when one has been derived.""" task_type: TaskType | None = None """Whether the remote task originated from CCA or CLI `--remote`.""" @staticmethod def from_dict(obj: Any) -> 'RemoteSessionMetadataValue': assert isinstance(obj, dict) is_remote = from_bool(obj.get("isRemote")) modified_time = from_str(obj.get("modifiedTime")) remote_session_ids = from_list(from_str, obj.get("remoteSessionIds")) repository = RemoteSessionMetadataRepository.from_dict(obj.get("repository")) session_id = from_str(obj.get("sessionId")) start_time = from_str(obj.get("startTime")) context = from_union([SessionContext.from_dict, from_none], obj.get("context")) name = from_union([from_str, from_none], obj.get("name")) pull_request_number = from_union([from_int, from_none], obj.get("pullRequestNumber")) resource_id = from_union([from_str, from_none], obj.get("resourceId")) stale_at = from_union([from_str, from_none], obj.get("staleAt")) state = from_union([from_str, from_none], obj.get("state")) summary = from_union([from_str, from_none], obj.get("summary")) task_type = from_union([TaskType, from_none], obj.get("taskType")) return RemoteSessionMetadataValue(is_remote, modified_time, remote_session_ids, repository, session_id, start_time, context, name, pull_request_number, resource_id, stale_at, state, summary, task_type) def to_dict(self) -> dict: result: dict = {} result["isRemote"] = from_bool(self.is_remote) result["modifiedTime"] = from_str(self.modified_time) result["remoteSessionIds"] = from_list(from_str, self.remote_session_ids) result["repository"] = to_class(RemoteSessionMetadataRepository, self.repository) result["sessionId"] = from_str(self.session_id) result["startTime"] = from_str(self.start_time) if self.context is not None: result["context"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.context) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.pull_request_number is not None: result["pullRequestNumber"] = from_union([from_int, from_none], self.pull_request_number) if self.resource_id is not None: result["resourceId"] = from_union([from_str, from_none], self.resource_id) if self.stale_at is not None: result["staleAt"] = from_union([from_str, from_none], self.stale_at) if self.state is not None: result["state"] = from_union([from_str, from_none], self.state) if self.summary is not None: result["summary"] = from_union([from_str, from_none], self.summary) if self.task_type is not None: result["taskType"] = from_union([lambda x: to_enum(TaskType, x), from_none], self.task_type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetLastForContextRequest: """Optional working-directory context used to score session relevance.""" context: SessionContext | None = None """Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. """ @staticmethod def from_dict(obj: Any) -> 'SessionsGetLastForContextRequest': assert isinstance(obj, dict) context = from_union([SessionContext.from_dict, from_none], obj.get("context")) return SessionsGetLastForContextRequest(context) def to_dict(self) -> dict: result: dict = {} if self.context is not None: result["context"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.context) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecordContextChangeRequest: """Updated working-directory/git context to record on the session.""" context: SessionWorkingDirectoryContext """Updated working directory and git context. Emitted as the new payload of `session.context_changed`. """ @staticmethod def from_dict(obj: Any) -> 'MetadataRecordContextChangeRequest': assert isinstance(obj, dict) context = SessionWorkingDirectoryContext.from_dict(obj.get("context")) return MetadataRecordContextChangeRequest(context) def to_dict(self) -> dict: result: dict = {} result["context"] = to_class(SessionWorkingDirectoryContext, self.context) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsConfig: """If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. """ additional_directories: list[str] | None = None """Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the UnrestrictedPathManager so they remain visible via getDirectories() (e.g. for @-mention completion). """ include_temp_directory: bool | None = None """Whether to include the system temp directory in the allowed list (defaults to true). Ignored when `unrestricted` is true. """ unrestricted: bool | None = None """If true, the runtime allows access to all paths without prompting. Equivalent to constructing an UnrestrictedPathManager. """ workspace_path: str | None = None """Workspace root path (special-cased to be allowed even before the directory exists). Ignored when `unrestricted` is true. """ @staticmethod def from_dict(obj: Any) -> 'PermissionPathsConfig': assert isinstance(obj, dict) additional_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("additionalDirectories")) include_temp_directory = from_union([from_bool, from_none], obj.get("includeTempDirectory")) unrestricted = from_union([from_bool, from_none], obj.get("unrestricted")) workspace_path = from_union([from_str, from_none], obj.get("workspacePath")) return PermissionPathsConfig(additional_directories, include_temp_directory, unrestricted, workspace_path) def to_dict(self) -> dict: result: dict = {} if self.additional_directories is not None: result["additionalDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.additional_directories) if self.include_temp_directory is not None: result["includeTempDirectory"] = from_union([from_bool, from_none], self.include_temp_directory) if self.unrestricted is not None: result["unrestricted"] = from_union([from_bool, from_none], self.unrestricted) if self.workspace_path is not None: result["workspacePath"] = from_union([from_str, from_none], self.workspace_path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceSummary: """Public-facing projection of workspace metadata for SDK / TUI consumers""" id: str """Workspace identifier (1:1 with sessionId)""" branch: str | None = None """Branch checked out at session start, if any""" created_at: datetime | None = None """ISO 8601 timestamp when the workspace was created""" cwd: str | None = None """Current working directory at session start""" git_root: str | None = None """Resolved git root for cwd, if any""" host_type: HostType | None = None """Repository host type, if known""" name: str | None = None """Display name for the session, if set""" repository: str | None = None """Repository identifier in 'owner/repo' or 'org/project/repo' format, if any""" updated_at: datetime | None = None """ISO 8601 timestamp when the workspace was last updated""" user_named: bool | None = None """Whether the display name was explicitly set by the user""" @staticmethod def from_dict(obj: Any) -> 'WorkspaceSummary': assert isinstance(obj, dict) id = from_str(obj.get("id")) branch = from_union([from_str, from_none], obj.get("branch")) created_at = from_union([from_datetime, from_none], obj.get("created_at")) cwd = from_union([from_str, from_none], obj.get("cwd")) git_root = from_union([from_str, from_none], obj.get("git_root")) host_type = from_union([HostType, from_none], obj.get("host_type")) name = from_union([from_str, from_none], obj.get("name")) repository = from_union([from_str, from_none], obj.get("repository")) updated_at = from_union([from_datetime, from_none], obj.get("updated_at")) user_named = from_union([from_bool, from_none], obj.get("user_named")) return WorkspaceSummary(id, branch, created_at, cwd, git_root, host_type, name, repository, updated_at, user_named) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) if self.created_at is not None: result["created_at"] = from_union([lambda x: x.isoformat(), from_none], self.created_at) if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.git_root is not None: result["git_root"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: result["host_type"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) if self.updated_at is not None: result["updated_at"] = from_union([lambda x: x.isoformat(), from_none], self.updated_at) if self.user_named is not None: result["user_named"] = from_union([from_bool, from_none], self.user_named) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesGetWorkspaceResult: """Current workspace metadata for the session, including its absolute filesystem path when available. """ path: str | None = None """Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). """ workspace: Workspace | None = None """Current workspace metadata, or null if not available""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesGetWorkspaceResult': assert isinstance(obj, dict) path = from_union([from_str, from_none], obj.get("path")) workspace = from_union([Workspace.from_dict, from_none], obj.get("workspace")) return WorkspacesGetWorkspaceResult(path, workspace) def to_dict(self) -> dict: result: dict = {} if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) result["workspace"] = from_union([lambda x: to_class(Workspace, x), from_none], self.workspace) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesListCheckpointsResult: """Workspace checkpoints in chronological order; empty when the workspace is not enabled.""" checkpoints: list[WorkspacesCheckpoints] """Workspace checkpoints in chronological order. Empty when workspace is not enabled.""" @staticmethod def from_dict(obj: Any) -> 'WorkspacesListCheckpointsResult': assert isinstance(obj, dict) checkpoints = from_list(WorkspacesCheckpoints.from_dict, obj.get("checkpoints")) return WorkspacesListCheckpointsResult(checkpoints) def to_dict(self) -> dict: result: dict = {} result["checkpoints"] = from_list(lambda x: to_class(WorkspacesCheckpoints, x), self.checkpoints) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsHostContext: """Current host context advertised to MCP App guests.""" context: MCPAppsHostContextDetails """Current host context""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsHostContext': assert isinstance(obj, dict) context = MCPAppsHostContextDetails.from_dict(obj.get("context")) return MCPAppsHostContext(context) def to_dict(self) -> dict: result: dict = {} result["context"] = to_class(MCPAppsHostContextDetails, self.context) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsSetHostContextRequest: """Host context to advertise to MCP App guests.""" context: MCPAppsSetHostContextDetails """Host context advertised to MCP App guests""" @staticmethod def from_dict(obj: Any) -> 'MCPAppsSetHostContextRequest': assert isinstance(obj, dict) context = MCPAppsSetHostContextDetails.from_dict(obj.get("context")) return MCPAppsSetHostContextRequest(context) def to_dict(self) -> dict: result: dict = {} result["context"] = to_class(MCPAppsSetHostContextDetails, self.context) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPConfigAddRequest: """MCP server name and configuration to add to user configuration.""" config: MCPServerConfig """MCP server configuration (stdio process or remote HTTP/SSE)""" name: str """Unique name for the MCP server""" @staticmethod def from_dict(obj: Any) -> 'MCPConfigAddRequest': assert isinstance(obj, dict) config = MCPServerConfig.from_dict(obj.get("config")) name = from_str(obj.get("name")) return MCPConfigAddRequest(config, name) def to_dict(self) -> dict: result: dict = {} result["config"] = to_class(MCPServerConfig, self.config) result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPConfigList: """User-configured MCP servers, keyed by server name.""" servers: dict[str, MCPServerConfig] """All MCP servers from user config, keyed by name""" @staticmethod def from_dict(obj: Any) -> 'MCPConfigList': assert isinstance(obj, dict) servers = from_dict(MCPServerConfig.from_dict, obj.get("servers")) return MCPConfigList(servers) def to_dict(self) -> dict: result: dict = {} result["servers"] = from_dict(lambda x: to_class(MCPServerConfig, x), self.servers) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPConfigUpdateRequest: """MCP server name and replacement configuration to write to user configuration.""" config: MCPServerConfig """MCP server configuration (stdio process or remote HTTP/SSE)""" name: str """Name of the MCP server to update""" @staticmethod def from_dict(obj: Any) -> 'MCPConfigUpdateRequest': assert isinstance(obj, dict) config = MCPServerConfig.from_dict(obj.get("config")) name = from_str(obj.get("name")) return MCPConfigUpdateRequest(config, name) def to_dict(self) -> dict: result: dict = {} result["config"] = to_class(MCPServerConfig, self.config) result["name"] = from_str(self.name) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class MCPRestartServerRequest: """Server name and opaque configuration for an individual MCP server restart.""" server_name: str """Name of the MCP server to restart""" config: Any = None """Opaque server configuration (MCPServerConfig). Marked internal: an in-process runtime shape supplied only by in-process CLI callers. """ @staticmethod def from_dict(obj: Any) -> 'MCPRestartServerRequest': assert isinstance(obj, dict) config = obj.get("config") server_name = from_str(obj.get("serverName")) return MCPRestartServerRequest(config, server_name) def to_dict(self) -> dict: result: dict = {} result["config"] = self.config result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class MCPStartServerRequest: """Server name and opaque configuration for an individual MCP server start.""" server_name: str """Name of the MCP server to start""" config: Any = None """Opaque server configuration (MCPServerConfig). Marked internal: an in-process runtime shape supplied only by in-process CLI callers. """ @staticmethod def from_dict(obj: Any) -> 'MCPStartServerRequest': assert isinstance(obj, dict) config = obj.get("config") server_name = from_str(obj.get("serverName")) return MCPStartServerRequest(config, server_name) def to_dict(self) -> dict: result: dict = {} result["config"] = self.config result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPHeadersHandlePendingHeadersRefreshRequestRequest: """MCP headers refresh request id and the host response.""" request_id: str """Headers refresh request identifier from mcp.headers_refresh_required""" result: MCPHeadersHandlePendingHeadersRefreshRequest """Host response: supply dynamic headers or decline this refresh.""" @staticmethod def from_dict(obj: Any) -> 'MCPHeadersHandlePendingHeadersRefreshRequestRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = MCPHeadersHandlePendingHeadersRefreshRequest.from_dict(obj.get("result")) return MCPHeadersHandlePendingHeadersRefreshRequestRequest(request_id, result) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["result"] = to_class(MCPHeadersHandlePendingHeadersRefreshRequest, self.result) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthHandlePendingRequest: """Pending MCP OAuth request ID and host-provided token or cancellation response.""" request_id: str """OAuth request identifier from the mcp.oauth_required event""" result: MCPOauthPendingRequestResponse """Host response to the pending OAuth request.""" @staticmethod def from_dict(obj: Any) -> 'MCPOauthHandlePendingRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = MCPOauthPendingRequestResponse.from_dict(obj.get("result")) return MCPOauthHandlePendingRequest(request_id, result) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["result"] = to_class(MCPOauthPendingRequestResponse, self.result) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelBilling: """Billing information""" discount_percent: int | None = None """Whole-number percentage discount (0-100) applied to usage billed through this model. Populated for the synthetic `auto` model, where requests routed by auto-mode are billed at a reduced rate; absent for concrete models. """ multiplier: float | None = None """Billing cost multiplier relative to the base rate""" token_prices: ModelBillingTokenPrices | None = None """Token-level pricing information for this model""" @staticmethod def from_dict(obj: Any) -> 'ModelBilling': assert isinstance(obj, dict) discount_percent = from_union([from_int, from_none], obj.get("discountPercent")) multiplier = from_union([from_float, from_none], obj.get("multiplier")) token_prices = from_union([ModelBillingTokenPrices.from_dict, from_none], obj.get("tokenPrices")) return ModelBilling(discount_percent, multiplier, token_prices) def to_dict(self) -> dict: result: dict = {} if self.discount_percent is not None: result["discountPercent"] = from_union([from_int, from_none], self.discount_percent) if self.multiplier is not None: result["multiplier"] = from_union([to_float, from_none], self.multiplier) if self.token_prices is not None: result["tokenPrices"] = from_union([lambda x: to_class(ModelBillingTokenPrices, x), from_none], self.token_prices) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverride: """Optional capability overrides (vision, tool_calls, reasoning, etc.). Override individual model capabilities resolved by the runtime Initial model capability overrides. Per-property model capability overrides for the selected model. """ limits: ModelCapabilitiesOverrideLimits | None = None """Token limits for prompts, outputs, and context window""" supports: ModelCapabilitiesOverrideSupports | None = None """Feature flags indicating what the model supports""" @staticmethod def from_dict(obj: Any) -> 'ModelCapabilitiesOverride': assert isinstance(obj, dict) limits = from_union([ModelCapabilitiesOverrideLimits.from_dict, from_none], obj.get("limits")) supports = from_union([ModelCapabilitiesOverrideSupports.from_dict, from_none], obj.get("supports")) return ModelCapabilitiesOverride(limits, supports) def to_dict(self) -> dict: result: dict = {} if self.limits is not None: result["limits"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideLimits, x), from_none], self.limits) if self.supports is not None: result["supports"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideSupports, x), from_none], self.supports) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderTokenAcquireRequest: """Asks the SDK client to acquire a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Issued by the runtime before each outbound model request; the runtime does no caching, so this is sent once per request. """ provider_name: str """Name of the BYOK provider needing a token. For the legacy whole-session `provider` this is the implicit provider name; for named providers it is `NamedProviderConfig.name`. """ session_id: str """Target session identifier""" @staticmethod def from_dict(obj: Any) -> 'ProviderTokenAcquireRequest': assert isinstance(obj, dict) provider_name = from_str(obj.get("providerName")) session_id = from_str(obj.get("sessionId")) return ProviderTokenAcquireRequest(provider_name, session_id) def to_dict(self) -> dict: result: dict = {} result["providerName"] = from_str(self.provider_name) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class OptionsUpdateAdditionalContentExclusionPolicy: """Schema for the `OptionsUpdateAdditionalContentExclusionPolicy` type.""" last_updated_at: Any rules: list[OptionsUpdateAdditionalContentExclusionPolicyRule] scope: AdditionalContentExclusionPolicyScope """Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration.""" @staticmethod def from_dict(obj: Any) -> 'OptionsUpdateAdditionalContentExclusionPolicy': assert isinstance(obj, dict) last_updated_at = obj.get("last_updated_at") rules = from_list(OptionsUpdateAdditionalContentExclusionPolicyRule.from_dict, obj.get("rules")) scope = AdditionalContentExclusionPolicyScope(obj.get("scope")) return OptionsUpdateAdditionalContentExclusionPolicy(last_updated_at, rules, scope) def to_dict(self) -> dict: result: dict = {} result["last_updated_at"] = self.last_updated_at result["rules"] = from_list(lambda x: to_class(OptionsUpdateAdditionalContentExclusionPolicyRule, x), self.rules) result["scope"] = to_enum(AdditionalContentExclusionPolicyScope, self.scope) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicy: """Schema for the `PermissionsConfigureAdditionalContentExclusionPolicy` type.""" last_updated_at: Any rules: list[PermissionsConfigureAdditionalContentExclusionPolicyRule] scope: AdditionalContentExclusionPolicyScope """Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. """ @staticmethod def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicy': assert isinstance(obj, dict) last_updated_at = obj.get("last_updated_at") rules = from_list(PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict, obj.get("rules")) scope = AdditionalContentExclusionPolicyScope(obj.get("scope")) return PermissionsConfigureAdditionalContentExclusionPolicy(last_updated_at, rules, scope) def to_dict(self) -> dict: result: dict = {} result["last_updated_at"] = self.last_updated_at result["rules"] = from_list(lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, x), self.rules) result["scope"] = to_enum(AdditionalContentExclusionPolicyScope, self.scope) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPDiscoverResult: """MCP servers discovered from user, workspace, plugin, and built-in sources.""" servers: list[DiscoveredMCPServer] """MCP servers discovered from all sources""" @staticmethod def from_dict(obj: Any) -> 'MCPDiscoverResult': assert isinstance(obj, dict) servers = from_list(DiscoveredMCPServer.from_dict, obj.get("servers")) return MCPDiscoverResult(servers) def to_dict(self) -> dict: result: dict = {} result["servers"] = from_list(lambda x: to_class(DiscoveredMCPServer, x), self.servers) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginInstallResult: """Result of installing a plugin.""" plugin: InstalledPluginInfo """The newly installed plugin's metadata""" skills_installed: int """Number of skills discovered and installed from the plugin""" deprecation_warning: str | None = None """Set when the install path is deprecated (e.g. direct repo / URL / local installs). Callers should surface this to end users. """ post_install_message: str | None = None """Optional post-install message provided by the plugin (e.g. setup instructions)""" @staticmethod def from_dict(obj: Any) -> 'PluginInstallResult': assert isinstance(obj, dict) plugin = InstalledPluginInfo.from_dict(obj.get("plugin")) skills_installed = from_int(obj.get("skillsInstalled")) deprecation_warning = from_union([from_str, from_none], obj.get("deprecationWarning")) post_install_message = from_union([from_str, from_none], obj.get("postInstallMessage")) return PluginInstallResult(plugin, skills_installed, deprecation_warning, post_install_message) def to_dict(self) -> dict: result: dict = {} result["plugin"] = to_class(InstalledPluginInfo, self.plugin) result["skillsInstalled"] = from_int(self.skills_installed) if self.deprecation_warning is not None: result["deprecationWarning"] = from_union([from_str, from_none], self.deprecation_warning) if self.post_install_message is not None: result["postInstallMessage"] = from_union([from_str, from_none], self.post_install_message) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginListResult: """Plugins installed in user/global state.""" plugins: list[InstalledPluginInfo] """Installed plugins""" @staticmethod def from_dict(obj: Any) -> 'PluginListResult': assert isinstance(obj, dict) plugins = from_list(InstalledPluginInfo.from_dict, obj.get("plugins")) return PluginListResult(plugins) def to_dict(self) -> dict: result: dict = {} result["plugins"] = from_list(lambda x: to_class(InstalledPluginInfo, x), self.plugins) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MarketplaceBrowseResult: """Plugins advertised by the marketplace.""" plugins: list[MarketplacePluginInfo] """Plugins advertised by the marketplace""" @staticmethod def from_dict(obj: Any) -> 'MarketplaceBrowseResult': assert isinstance(obj, dict) plugins = from_list(MarketplacePluginInfo.from_dict, obj.get("plugins")) return MarketplaceBrowseResult(plugins) def to_dict(self) -> dict: result: dict = {} result["plugins"] = from_list(lambda x: to_class(MarketplacePluginInfo, x), self.plugins) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerList: """MCP servers configured for the session, with their connection status and host-level state.""" servers: list[MCPServer] """Configured MCP servers""" host: MCPHostState | None = None """Host-level state, omitted when no MCP host is initialized.""" @staticmethod def from_dict(obj: Any) -> 'MCPServerList': assert isinstance(obj, dict) servers = from_list(MCPServer.from_dict, obj.get("servers")) host = from_union([MCPHostState.from_dict, from_none], obj.get("host")) return MCPServerList(servers, host) def to_dict(self) -> dict: result: dict = {} result["servers"] = from_list(lambda x: to_class(MCPServer, x), self.servers) if self.host is not None: result["host"] = from_union([lambda x: to_class(MCPHostState, x), from_none], self.host) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginUpdateAllResult: """Result of updating all installed plugins.""" results: list[PluginUpdateAllEntry] """Per-plugin update results in deterministic order.""" @staticmethod def from_dict(obj: Any) -> 'PluginUpdateAllResult': assert isinstance(obj, dict) results = from_list(PluginUpdateAllEntry.from_dict, obj.get("results")) return PluginUpdateAllResult(results) def to_dict(self) -> dict: result: dict = {} result["results"] = from_list(lambda x: to_class(PluginUpdateAllEntry, x), self.results) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubFileDiff: """Pointer to a single-file diff. At least one of `head` and `base` must be present.""" type: ClassVar[str] = "github_file_diff" """Attachment type discriminator""" url: str """URL to the diff on GitHub (e.g., a commit, compare, or PR-file URL)""" base: PushAttachmentGitHubFileDiffSide | None = None """File location on the base side of the diff. Absent for additions.""" head: PushAttachmentGitHubFileDiffSide | None = None """File location on the head side of the diff. Absent for deletions.""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubFileDiff': assert isinstance(obj, dict) url = from_str(obj.get("url")) base = from_union([PushAttachmentGitHubFileDiffSide.from_dict, from_none], obj.get("base")) head = from_union([PushAttachmentGitHubFileDiffSide.from_dict, from_none], obj.get("head")) return PushAttachmentGitHubFileDiff(url, base, head) def to_dict(self) -> dict: result: dict = {} result["type"] = self.type result["url"] = from_str(self.url) if self.base is not None: result["base"] = from_union([lambda x: to_class(PushAttachmentGitHubFileDiffSide, x), from_none], self.base) if self.head is not None: result["head"] = from_union([lambda x: to_class(PushAttachmentGitHubFileDiffSide, x), from_none], self.head) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentGitHubTreeComparison: """Pointer to a comparison between two git revisions.""" base: PushAttachmentGitHubTreeComparisonSide """Base side of the comparison""" head: PushAttachmentGitHubTreeComparisonSide """Head side of the comparison""" type: ClassVar[str] = "github_tree_comparison" """Attachment type discriminator""" url: str """URL to the comparison on GitHub""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentGitHubTreeComparison': assert isinstance(obj, dict) base = PushAttachmentGitHubTreeComparisonSide.from_dict(obj.get("base")) head = PushAttachmentGitHubTreeComparisonSide.from_dict(obj.get("head")) url = from_str(obj.get("url")) return PushAttachmentGitHubTreeComparison(base, head, url) def to_dict(self) -> dict: result: dict = {} result["base"] = to_class(PushAttachmentGitHubTreeComparisonSide, self.base) result["head"] = to_class(PushAttachmentGitHubTreeComparisonSide, self.head) result["type"] = self.type result["url"] = from_str(self.url) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PushAttachmentSelection: """Code selection attachment from an editor""" display_name: str """User-facing display name for the selection""" file_path: str """Absolute path to the file containing the selection""" selection: PushAttachmentSelectionDetails """Position range of the selection within the file""" text: str """The selected text content""" type: ClassVar[str] = "selection" """Attachment type discriminator""" @staticmethod def from_dict(obj: Any) -> 'PushAttachmentSelection': assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) file_path = from_str(obj.get("filePath")) selection = PushAttachmentSelectionDetails.from_dict(obj.get("selection")) text = from_str(obj.get("text")) return PushAttachmentSelection(display_name, file_path, selection, text) def to_dict(self) -> dict: result: dict = {} result["displayName"] = from_str(self.display_name) result["filePath"] = from_str(self.file_path) result["selection"] = to_class(PushAttachmentSelectionDetails, self.selection) result["text"] = from_str(self.text) result["type"] = self.type return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuePendingItemsResult: """Snapshot of the session's pending queued items and immediate-steering messages.""" items: list[QueuePendingItems] """Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. """ steering_messages: list[str] """Display text for messages currently in the immediate steering queue (interjections sent during a running turn). """ @staticmethod def from_dict(obj: Any) -> 'QueuePendingItemsResult': assert isinstance(obj, dict) items = from_list(QueuePendingItems.from_dict, obj.get("items")) steering_messages = from_list(from_str, obj.get("steeringMessages")) return QueuePendingItemsResult(items, steering_messages) def to_dict(self) -> dict: result: dict = {} result["items"] = from_list(lambda x: to_class(QueuePendingItems, x), self.items) result["steeringMessages"] = from_list(from_str, self.steering_messages) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsStartRemoteControlRequest: """Parameters for attaching the remote-control singleton to a session.""" config: RemoteControlConfig """Configuration for the runtime-managed remote-control singleton.""" session_id: str """Local session id to attach remote control to.""" @staticmethod def from_dict(obj: Any) -> 'SessionsStartRemoteControlRequest': assert isinstance(obj, dict) config = RemoteControlConfig.from_dict(obj.get("config")) session_id = from_str(obj.get("sessionId")) return SessionsStartRemoteControlRequest(config, session_id) def to_dict(self) -> dict: result: dict = {} result["config"] = to_class(RemoteControlConfig, self.config) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SandboxConfigUserPolicy: """User-managed sandbox policy fragment merged into the auto-discovered base policy.""" experimental: SandboxConfigUserPolicyExperimental | None = None """Deprecated legacy location for `seatbelt`; read only when the top-level `seatbelt` is absent. """ filesystem: SandboxConfigUserPolicyFilesystem | None = None """Filesystem rules to merge into the base policy.""" network: SandboxConfigUserPolicyNetwork | None = None """Network rules to merge into the base policy.""" seatbelt: SandboxConfigUserPolicySeatbelt | None = None """macOS seatbelt options to merge into the base policy.""" @staticmethod def from_dict(obj: Any) -> 'SandboxConfigUserPolicy': assert isinstance(obj, dict) experimental = from_union([SandboxConfigUserPolicyExperimental.from_dict, from_none], obj.get("experimental")) filesystem = from_union([SandboxConfigUserPolicyFilesystem.from_dict, from_none], obj.get("filesystem")) network = from_union([SandboxConfigUserPolicyNetwork.from_dict, from_none], obj.get("network")) seatbelt = from_union([SandboxConfigUserPolicySeatbelt.from_dict, from_none], obj.get("seatbelt")) return SandboxConfigUserPolicy(experimental, filesystem, network, seatbelt) def to_dict(self) -> dict: result: dict = {} if self.experimental is not None: result["experimental"] = from_union([lambda x: to_class(SandboxConfigUserPolicyExperimental, x), from_none], self.experimental) if self.filesystem is not None: result["filesystem"] = from_union([lambda x: to_class(SandboxConfigUserPolicyFilesystem, x), from_none], self.filesystem) if self.network is not None: result["network"] = from_union([lambda x: to_class(SandboxConfigUserPolicyNetwork, x), from_none], self.network) if self.seatbelt is not None: result["seatbelt"] = from_union([lambda x: to_class(SandboxConfigUserPolicySeatbelt, x), from_none], self.seatbelt) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReadFileResult: """File content as a UTF-8 string, or a filesystem error if the read failed.""" content: str """File content as UTF-8 string""" error: SessionFSError | None = None """Describes a filesystem error.""" @staticmethod def from_dict(obj: Any) -> 'SessionFSReadFileResult': assert isinstance(obj, dict) content = from_str(obj.get("content")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) return SessionFSReadFileResult(content, error) def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) if self.error is not None: result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirResult: """Names of entries in the requested directory, or a filesystem error if the read failed.""" entries: list[str] """Entry names in the directory""" error: SessionFSError | None = None """Describes a filesystem error.""" @staticmethod def from_dict(obj: Any) -> 'SessionFSReaddirResult': assert isinstance(obj, dict) entries = from_list(from_str, obj.get("entries")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) return SessionFSReaddirResult(entries, error) def to_dict(self) -> dict: result: dict = {} result["entries"] = from_list(from_str, self.entries) if self.error is not None: result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirWithTypesResult: """Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. """ entries: list[SessionFSReaddirWithTypesEntry] """Directory entries with type information""" error: SessionFSError | None = None """Describes a filesystem error.""" @staticmethod def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesResult': assert isinstance(obj, dict) entries = from_list(SessionFSReaddirWithTypesEntry.from_dict, obj.get("entries")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) return SessionFSReaddirWithTypesResult(entries, error) def to_dict(self) -> dict: result: dict = {} result["entries"] = from_list(lambda x: to_class(SessionFSReaddirWithTypesEntry, x), self.entries) if self.error is not None: result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSqliteQueryResult: """Query results including rows, columns, and rows affected, or a filesystem error if execution failed. """ columns: list[str] """Column names from the result set""" rows: list[dict[str, Any]] """For SELECT: array of row objects. For others: empty array.""" rows_affected: int """Number of rows affected (for INSERT/UPDATE/DELETE)""" error: SessionFSError | None = None """Describes a filesystem error.""" last_insert_rowid: int | None = None """SQLite last_insert_rowid() value for INSERT.""" @staticmethod def from_dict(obj: Any) -> 'SessionFSSqliteQueryResult': assert isinstance(obj, dict) columns = from_list(from_str, obj.get("columns")) rows = from_list(lambda x: from_dict(lambda x: x, x), obj.get("rows")) rows_affected = from_int(obj.get("rowsAffected")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) last_insert_rowid = from_union([from_int, from_none], obj.get("lastInsertRowid")) return SessionFSSqliteQueryResult(columns, rows, rows_affected, error, last_insert_rowid) def to_dict(self) -> dict: result: dict = {} result["columns"] = from_list(from_str, self.columns) result["rows"] = from_list(lambda x: from_dict(lambda x: x, x), self.rows) result["rowsAffected"] = from_int(self.rows_affected) if self.error is not None: result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) if self.last_insert_rowid is not None: result["lastInsertRowid"] = from_union([from_int, from_none], self.last_insert_rowid) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSStatResult: """Filesystem metadata for the requested path, or a filesystem error if the stat failed.""" birthtime: datetime """ISO 8601 timestamp of creation""" is_directory: bool """Whether the path is a directory""" is_file: bool """Whether the path is a file""" mtime: datetime """ISO 8601 timestamp of last modification""" size: int """File size in bytes""" error: SessionFSError | None = None """Describes a filesystem error.""" @staticmethod def from_dict(obj: Any) -> 'SessionFSStatResult': assert isinstance(obj, dict) birthtime = from_datetime(obj.get("birthtime")) is_directory = from_bool(obj.get("isDirectory")) is_file = from_bool(obj.get("isFile")) mtime = from_datetime(obj.get("mtime")) size = from_int(obj.get("size")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) return SessionFSStatResult(birthtime, is_directory, is_file, mtime, size, error) def to_dict(self) -> dict: result: dict = {} result["birthtime"] = self.birthtime.isoformat() result["isDirectory"] = from_bool(self.is_directory) result["isFile"] = from_bool(self.is_file) result["mtime"] = self.mtime.isoformat() result["size"] = from_int(self.size) if self.error is not None: result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionOpenOptionsAdditionalContentExclusionPolicy: """Schema for the `SessionOpenOptionsAdditionalContentExclusionPolicy` type.""" last_updated_at: Any rules: list[SessionOpenOptionsAdditionalContentExclusionPolicyRule] scope: AdditionalContentExclusionPolicyScope """Allowed values for the `SessionOpenOptionsAdditionalContentExclusionPolicyScope` enumeration. """ @staticmethod def from_dict(obj: Any) -> 'SessionOpenOptionsAdditionalContentExclusionPolicy': assert isinstance(obj, dict) last_updated_at = obj.get("last_updated_at") rules = from_list(SessionOpenOptionsAdditionalContentExclusionPolicyRule.from_dict, obj.get("rules")) scope = AdditionalContentExclusionPolicyScope(obj.get("scope")) return SessionOpenOptionsAdditionalContentExclusionPolicy(last_updated_at, rules, scope) def to_dict(self) -> dict: result: dict = {} result["last_updated_at"] = self.last_updated_at result["rules"] = from_list(lambda x: to_class(SessionOpenOptionsAdditionalContentExclusionPolicyRule, x), self.rules) result["scope"] = to_enum(AdditionalContentExclusionPolicyScope, self.scope) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentGetCurrentResult: """The currently selected custom agent, or null when using the default agent.""" agent: AgentInfo | None = None """Currently selected custom agent, or null if using the default agent""" @staticmethod def from_dict(obj: Any) -> 'AgentGetCurrentResult': assert isinstance(obj, dict) agent = from_union([AgentInfo.from_dict, from_none], obj.get("agent")) return AgentGetCurrentResult(agent) def to_dict(self) -> dict: result: dict = {} if self.agent is not None: result["agent"] = from_union([lambda x: to_class(AgentInfo, x), from_none], self.agent) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentList: """Custom agents available to the session.""" agents: list[AgentInfo] """Available custom agents""" @staticmethod def from_dict(obj: Any) -> 'AgentList': assert isinstance(obj, dict) agents = from_list(AgentInfo.from_dict, obj.get("agents")) return AgentList(agents) def to_dict(self) -> dict: result: dict = {} result["agents"] = from_list(lambda x: to_class(AgentInfo, x), self.agents) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentReloadResult: """Custom agents available to the session after reloading definitions from disk.""" agents: list[AgentInfo] """Reloaded custom agents""" @staticmethod def from_dict(obj: Any) -> 'AgentReloadResult': assert isinstance(obj, dict) agents = from_list(AgentInfo.from_dict, obj.get("agents")) return AgentReloadResult(agents) def to_dict(self) -> dict: result: dict = {} result["agents"] = from_list(lambda x: to_class(AgentInfo, x), self.agents) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentSelectResult: """The newly selected custom agent.""" agent: AgentInfo """The newly selected custom agent""" @staticmethod def from_dict(obj: Any) -> 'AgentSelectResult': assert isinstance(obj, dict) agent = AgentInfo.from_dict(obj.get("agent")) return AgentSelectResult(agent) def to_dict(self) -> dict: result: dict = {} result["agent"] = to_class(AgentInfo, self.agent) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ServerAgentList: """Agents discovered across user, project, plugin, and remote sources.""" agents: list[AgentInfo] """All discovered agents across all sources""" @staticmethod def from_dict(obj: Any) -> 'ServerAgentList': assert isinstance(obj, dict) agents = from_list(AgentInfo.from_dict, obj.get("agents")) return ServerAgentList(agents) def to_dict(self) -> dict: result: dict = {} result["agents"] = from_list(lambda x: to_class(AgentInfo, x), self.agents) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillDiscoveryPathList: """Canonical locations where skills can be created so the runtime will recognize them.""" paths: list[SkillDiscoveryPath] """Canonical skill create/discovery directories, in priority order""" @staticmethod def from_dict(obj: Any) -> 'SkillDiscoveryPathList': assert isinstance(obj, dict) paths = from_list(SkillDiscoveryPath.from_dict, obj.get("paths")) return SkillDiscoveryPathList(paths) def to_dict(self) -> dict: result: dict = {} result["paths"] = from_list(lambda x: to_class(SkillDiscoveryPath, x), self.paths) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskProgress: """Schema for the `TaskAgentProgress` type. Schema for the `TaskShellProgress` type. """ type: TaskInfoType """Progress kind""" latest_intent: str | None = None """The most recent intent reported by the agent""" recent_activity: list[TaskProgressLine] | None = None """Recent tool execution events converted to display lines""" pid: int | None = None """Process ID when available""" recent_output: str | None = None """Recent stdout/stderr lines from the running shell command""" @staticmethod def from_dict(obj: Any) -> 'TaskProgress': assert isinstance(obj, dict) type = TaskInfoType(obj.get("type")) latest_intent = from_union([from_str, from_none], obj.get("latestIntent")) recent_activity = from_union([lambda x: from_list(TaskProgressLine.from_dict, x), from_none], obj.get("recentActivity")) pid = from_union([from_int, from_none], obj.get("pid")) recent_output = from_union([from_str, from_none], obj.get("recentOutput")) return TaskProgress(type, latest_intent, recent_activity, pid, recent_output) def to_dict(self) -> dict: result: dict = {} result["type"] = to_enum(TaskInfoType, self.type) if self.latest_intent is not None: result["latestIntent"] = from_union([from_str, from_none], self.latest_intent) if self.recent_activity is not None: result["recentActivity"] = from_union([lambda x: from_list(lambda x: to_class(TaskProgressLine, x), x), from_none], self.recent_activity) if self.pid is not None: result["pid"] = from_union([from_int, from_none], self.pid) if self.recent_output is not None: result["recentOutput"] = from_union([from_str, from_none], self.recent_output) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPListToolsResult: """Tools exposed by the connected MCP server. Throws when the server is not connected.""" tools: list[MCPTools] """Tools exposed by the server.""" @staticmethod def from_dict(obj: Any) -> 'MCPListToolsResult': assert isinstance(obj, dict) tools = from_list(MCPTools.from_dict, obj.get("tools")) return MCPListToolsResult(tools) def to_dict(self) -> dict: result: dict = {} result["tools"] = from_list(lambda x: to_class(MCPTools, x), self.tools) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfField: """Multi-select string field where each option pairs a value with a display label.""" items: UIElicitationArrayAnyOfFieldItems """Schema applied to each item in the array.""" type: UIElicitationArrayAnyOfFieldType """Type discriminator. Always "array".""" default: list[str] | None = None """Default values selected when the form is first shown.""" description: str | None = None """Help text describing the field.""" max_items: int | None = None """Maximum number of items the user may select.""" min_items: int | None = None """Minimum number of items the user must select.""" title: str | None = None """Human-readable label for the field.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfField': assert isinstance(obj, dict) items = UIElicitationArrayAnyOfFieldItems.from_dict(obj.get("items")) type = UIElicitationArrayAnyOfFieldType(obj.get("type")) default = from_union([lambda x: from_list(from_str, x), from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) title = from_union([from_str, from_none], obj.get("title")) return UIElicitationArrayAnyOfField(items, type, default, description, max_items, min_items, title) def to_dict(self) -> dict: result: dict = {} result["items"] = to_class(UIElicitationArrayAnyOfFieldItems, self.items) result["type"] = to_enum(UIElicitationArrayAnyOfFieldType, self.type) if self.default is not None: result["default"] = from_union([lambda x: from_list(from_str, x), from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.max_items is not None: result["maxItems"] = from_union([from_int, from_none], self.max_items) if self.min_items is not None: result["minItems"] = from_union([from_int, from_none], self.min_items) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayEnumField: """Multi-select string field whose allowed values are defined inline.""" items: UIElicitationArrayEnumFieldItems """Schema applied to each item in the array.""" type: UIElicitationArrayAnyOfFieldType """Type discriminator. Always "array".""" default: list[str] | None = None """Default values selected when the form is first shown.""" description: str | None = None """Help text describing the field.""" max_items: int | None = None """Maximum number of items the user may select.""" min_items: int | None = None """Minimum number of items the user must select.""" title: str | None = None """Human-readable label for the field.""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationArrayEnumField': assert isinstance(obj, dict) items = UIElicitationArrayEnumFieldItems.from_dict(obj.get("items")) type = UIElicitationArrayAnyOfFieldType(obj.get("type")) default = from_union([lambda x: from_list(from_str, x), from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) title = from_union([from_str, from_none], obj.get("title")) return UIElicitationArrayEnumField(items, type, default, description, max_items, min_items, title) def to_dict(self) -> dict: result: dict = {} result["items"] = to_class(UIElicitationArrayEnumFieldItems, self.items) result["type"] = to_enum(UIElicitationArrayAnyOfFieldType, self.type) if self.default is not None: result["default"] = from_union([lambda x: from_list(from_str, x), from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.max_items is not None: result["maxItems"] = from_union([from_int, from_none], self.max_items) if self.min_items is not None: result["minItems"] = from_union([from_int, from_none], self.min_items) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaProperty: """Definition for a single elicitation form field. Single-select string field whose allowed values are defined inline. Single-select string field where each option pairs a value with a display label. Multi-select string field whose allowed values are defined inline. Multi-select string field where each option pairs a value with a display label. Boolean field rendered as a yes/no toggle. Free-text string field with optional length and format constraints. Numeric field accepting either a number or an integer. """ type: UIElicitationSchemaPropertyType """Type discriminator. Always "string". Type discriminator. Always "array". Type discriminator. Always "boolean". Numeric type accepted by the field. """ default: float | bool | list[str] | str | None = None """Default value selected when the form is first shown. Default values selected when the form is first shown. Default value populated in the input when the form is first shown. """ description: str | None = None """Help text describing the field.""" enum: list[str] | None = None """Allowed string values.""" enum_names: list[str] | None = None """Optional display labels for each enum value, in the same order as `enum`.""" title: str | None = None """Human-readable label for the field.""" one_of: list[UIElicitationStringOneOfFieldOneOf] | None = None """Selectable options, each with a value and a display label.""" items: UIElicitationArrayFieldItems | None = None """Schema applied to each item in the array.""" max_items: int | None = None """Maximum number of items the user may select.""" min_items: int | None = None """Minimum number of items the user must select.""" format: UIElicitationSchemaPropertyStringFormat | None = None """Optional format hint that constrains the accepted input.""" max_length: int | None = None """Maximum number of characters allowed.""" min_length: int | None = None """Minimum number of characters required.""" maximum: float | None = None """Maximum allowed value (inclusive).""" minimum: float | None = None """Minimum allowed value (inclusive).""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationSchemaProperty': assert isinstance(obj, dict) type = UIElicitationSchemaPropertyType(obj.get("type")) default = from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) enum = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enum")) enum_names = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enumNames")) title = from_union([from_str, from_none], obj.get("title")) one_of = from_union([lambda x: from_list(UIElicitationStringOneOfFieldOneOf.from_dict, x), from_none], obj.get("oneOf")) items = from_union([UIElicitationArrayFieldItems.from_dict, from_none], obj.get("items")) max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) format = from_union([UIElicitationSchemaPropertyStringFormat, from_none], obj.get("format")) max_length = from_union([from_int, from_none], obj.get("maxLength")) min_length = from_union([from_int, from_none], obj.get("minLength")) maximum = from_union([from_float, from_none], obj.get("maximum")) minimum = from_union([from_float, from_none], obj.get("minimum")) return UIElicitationSchemaProperty(type, default, description, enum, enum_names, title, one_of, items, max_items, min_items, format, max_length, min_length, maximum, minimum) def to_dict(self) -> dict: result: dict = {} result["type"] = to_enum(UIElicitationSchemaPropertyType, self.type) if self.default is not None: result["default"] = from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.enum is not None: result["enum"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum) if self.enum_names is not None: result["enumNames"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum_names) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) if self.one_of is not None: result["oneOf"] = from_union([lambda x: from_list(lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), x), from_none], self.one_of) if self.items is not None: result["items"] = from_union([lambda x: to_class(UIElicitationArrayFieldItems, x), from_none], self.items) if self.max_items is not None: result["maxItems"] = from_union([from_int, from_none], self.max_items) if self.min_items is not None: result["minItems"] = from_union([from_int, from_none], self.min_items) if self.format is not None: result["format"] = from_union([lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], self.format) if self.max_length is not None: result["maxLength"] = from_union([from_int, from_none], self.max_length) if self.min_length is not None: result["minLength"] = from_union([from_int, from_none], self.min_length) if self.maximum is not None: result["maximum"] = from_union([to_float, from_none], self.maximum) if self.minimum is not None: result["minimum"] = from_union([to_float, from_none], self.minimum) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingElicitationRequest: """Pending elicitation request ID and the user's response (accept/decline/cancel + form values). """ request_id: str """The unique request ID from the elicitation.requested event""" result: UIElicitationResponse """The elicitation response (accept with form values, decline, or cancel)""" @staticmethod def from_dict(obj: Any) -> 'UIHandlePendingElicitationRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = UIElicitationResponse.from_dict(obj.get("result")) return UIHandlePendingElicitationRequest(request_id, result) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["result"] = to_class(UIElicitationResponse, self.result) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingExitPlanModeRequest: """Request ID of a pending `exit_plan_mode.requested` event and the user's response.""" request_id: str """The unique request ID from the exit_plan_mode.requested event""" response: UIExitPlanModeResponse """Schema for the `UIExitPlanModeResponse` type.""" @staticmethod def from_dict(obj: Any) -> 'UIHandlePendingExitPlanModeRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIExitPlanModeResponse.from_dict(obj.get("response")) return UIHandlePendingExitPlanModeRequest(request_id, response) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["response"] = to_class(UIExitPlanModeResponse, self.response) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingSessionLimitsExhaustedRequest: """Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action. """ request_id: str """The unique request ID from the session_limits_exhausted.requested event""" response: UISessionLimitsExhaustedResponse """The selected session-limit action.""" @staticmethod def from_dict(obj: Any) -> 'UIHandlePendingSessionLimitsExhaustedRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UISessionLimitsExhaustedResponse.from_dict(obj.get("response")) return UIHandlePendingSessionLimitsExhaustedRequest(request_id, response) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) result["response"] = to_class(UISessionLimitsExhaustedResponse, self.response) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageGetMetricsResult: """Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. """ code_changes: UsageMetricsCodeChanges """Aggregated code change metrics""" last_call_input_tokens: int """Input tokens from the most recent main-agent API call""" last_call_output_tokens: int """Output tokens from the most recent main-agent API call""" model_metrics: dict[str, UsageMetricsModelMetric] """Per-model token and request metrics, keyed by model identifier""" session_start_time: datetime """ISO 8601 timestamp when the session started""" total_api_duration_ms: int """Total time spent in model API calls (milliseconds)""" total_premium_request_cost: float """Total user-initiated premium request cost across all models (may be fractional due to multipliers) """ total_user_requests: int """Raw count of user-initiated API requests""" current_model: str | None = None """Currently active model identifier""" token_details: dict[str, UsageMetricsTokenDetail] | None = None """Session-wide per-token-type accumulated token counts""" total_nano_aiu: float | None = None """Session-wide accumulated nano-AI units cost""" @staticmethod def from_dict(obj: Any) -> 'UsageGetMetricsResult': assert isinstance(obj, dict) code_changes = UsageMetricsCodeChanges.from_dict(obj.get("codeChanges")) last_call_input_tokens = from_int(obj.get("lastCallInputTokens")) last_call_output_tokens = from_int(obj.get("lastCallOutputTokens")) model_metrics = from_dict(UsageMetricsModelMetric.from_dict, obj.get("modelMetrics")) session_start_time = from_datetime(obj.get("sessionStartTime")) total_api_duration_ms = from_int(obj.get("totalApiDurationMs")) total_premium_request_cost = from_float(obj.get("totalPremiumRequestCost")) total_user_requests = from_int(obj.get("totalUserRequests")) current_model = from_union([from_str, from_none], obj.get("currentModel")) token_details = from_union([lambda x: from_dict(UsageMetricsTokenDetail.from_dict, x), from_none], obj.get("tokenDetails")) total_nano_aiu = from_union([from_float, from_none], obj.get("totalNanoAiu")) return UsageGetMetricsResult(code_changes, last_call_input_tokens, last_call_output_tokens, model_metrics, session_start_time, total_api_duration_ms, total_premium_request_cost, total_user_requests, current_model, token_details, total_nano_aiu) def to_dict(self) -> dict: result: dict = {} result["codeChanges"] = to_class(UsageMetricsCodeChanges, self.code_changes) result["lastCallInputTokens"] = from_int(self.last_call_input_tokens) result["lastCallOutputTokens"] = from_int(self.last_call_output_tokens) result["modelMetrics"] = from_dict(lambda x: to_class(UsageMetricsModelMetric, x), self.model_metrics) result["sessionStartTime"] = self.session_start_time.isoformat() result["totalApiDurationMs"] = from_int(self.total_api_duration_ms) result["totalPremiumRequestCost"] = to_float(self.total_premium_request_cost) result["totalUserRequests"] = from_int(self.total_user_requests) if self.current_model is not None: result["currentModel"] = from_union([from_str, from_none], self.current_model) if self.token_details is not None: result["tokenDetails"] = from_union([lambda x: from_dict(lambda x: to_class(UsageMetricsTokenDetail, x), x), from_none], self.token_details) if self.total_nano_aiu is not None: result["totalNanoAiu"] = from_union([to_float, from_none], self.total_nano_aiu) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceDiffResult: """Workspace diff result for the requested mode.""" changes: list[WorkspaceDiffFileChange] """Changed files and their unified diffs.""" is_fallback: bool """Whether a requested branch diff fell back to unstaged changes because branch diff failed.""" mode: WorkspaceDiffMode """Effective mode used for the returned changes.""" requested_mode: WorkspaceDiffMode """Diff mode requested by the client.""" base_branch: str | None = None """Default branch used for a branch diff, when branch mode was requested.""" @staticmethod def from_dict(obj: Any) -> 'WorkspaceDiffResult': assert isinstance(obj, dict) changes = from_list(WorkspaceDiffFileChange.from_dict, obj.get("changes")) is_fallback = from_bool(obj.get("isFallback")) mode = WorkspaceDiffMode(obj.get("mode")) requested_mode = WorkspaceDiffMode(obj.get("requestedMode")) base_branch = from_union([from_str, from_none], obj.get("baseBranch")) return WorkspaceDiffResult(changes, is_fallback, mode, requested_mode, base_branch) def to_dict(self) -> dict: result: dict = {} result["changes"] = from_list(lambda x: to_class(WorkspaceDiffFileChange, x), self.changes) result["isFallback"] = from_bool(self.is_fallback) result["mode"] = to_enum(WorkspaceDiffMode, self.mode) result["requestedMode"] = to_enum(WorkspaceDiffMode, self.requested_mode) if self.base_branch is not None: result["baseBranch"] = from_union([from_str, from_none], self.base_branch) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandList: """Slash commands available in the session, after applying any include/exclude filters.""" commands: list[SlashCommandInfo] """Commands available in this session""" @staticmethod def from_dict(obj: Any) -> 'CommandList': assert isinstance(obj, dict) commands = from_list(SlashCommandInfo.from_dict, obj.get("commands")) return CommandList(commands) def to_dict(self) -> dict: result: dict = {} result["commands"] = from_list(lambda x: to_class(SlashCommandInfo, x), self.commands) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasProviderCloseRequest: """Canvas close parameters sent to the provider.""" canvas_id: str """Provider-local canvas identifier""" extension_id: str """Owning provider identifier""" instance_id: str """Canvas instance identifier""" session_id: str """Target session identifier""" host: CanvasHostContext | None = None """Host context supplied by the runtime.""" session: CanvasSessionContext | None = None """Session context supplied by the runtime.""" @staticmethod def from_dict(obj: Any) -> 'CanvasProviderCloseRequest': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) extension_id = from_str(obj.get("extensionId")) instance_id = from_str(obj.get("instanceId")) session_id = from_str(obj.get("sessionId")) host = from_union([CanvasHostContext.from_dict, from_none], obj.get("host")) session = from_union([CanvasSessionContext.from_dict, from_none], obj.get("session")) return CanvasProviderCloseRequest(canvas_id, extension_id, instance_id, session_id, host, session) def to_dict(self) -> dict: result: dict = {} result["canvasId"] = from_str(self.canvas_id) result["extensionId"] = from_str(self.extension_id) result["instanceId"] = from_str(self.instance_id) result["sessionId"] = from_str(self.session_id) if self.host is not None: result["host"] = from_union([lambda x: to_class(CanvasHostContext, x), from_none], self.host) if self.session is not None: result["session"] = from_union([lambda x: to_class(CanvasSessionContext, x), from_none], self.session) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasProviderInvokeActionRequest: """Canvas action invocation parameters sent to the provider.""" action_name: str """Action name to invoke""" canvas_id: str """Provider-local canvas identifier""" extension_id: str """Owning provider identifier""" instance_id: str """Canvas instance identifier""" session_id: str """Target session identifier""" host: CanvasHostContext | None = None """Host context supplied by the runtime.""" input: Any = None """Action input""" session: CanvasSessionContext | None = None """Session context supplied by the runtime.""" @staticmethod def from_dict(obj: Any) -> 'CanvasProviderInvokeActionRequest': assert isinstance(obj, dict) action_name = from_str(obj.get("actionName")) canvas_id = from_str(obj.get("canvasId")) extension_id = from_str(obj.get("extensionId")) instance_id = from_str(obj.get("instanceId")) session_id = from_str(obj.get("sessionId")) host = from_union([CanvasHostContext.from_dict, from_none], obj.get("host")) input = obj.get("input") session = from_union([CanvasSessionContext.from_dict, from_none], obj.get("session")) return CanvasProviderInvokeActionRequest(action_name, canvas_id, extension_id, instance_id, session_id, host, input, session) def to_dict(self) -> dict: result: dict = {} result["actionName"] = from_str(self.action_name) result["canvasId"] = from_str(self.canvas_id) result["extensionId"] = from_str(self.extension_id) result["instanceId"] = from_str(self.instance_id) result["sessionId"] = from_str(self.session_id) if self.host is not None: result["host"] = from_union([lambda x: to_class(CanvasHostContext, x), from_none], self.host) if self.input is not None: result["input"] = self.input if self.session is not None: result["session"] = from_union([lambda x: to_class(CanvasSessionContext, x), from_none], self.session) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasProviderOpenRequest: """Canvas open parameters sent to the provider.""" canvas_id: str """Provider-local canvas identifier""" extension_id: str """Owning provider identifier""" instance_id: str """Stable caller-supplied canvas instance identifier""" session_id: str """Target session identifier""" host: CanvasHostContext | None = None """Host context supplied by the runtime.""" input: Any = None """Canvas open input""" session: CanvasSessionContext | None = None """Session context supplied by the runtime.""" @staticmethod def from_dict(obj: Any) -> 'CanvasProviderOpenRequest': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) extension_id = from_str(obj.get("extensionId")) instance_id = from_str(obj.get("instanceId")) session_id = from_str(obj.get("sessionId")) host = from_union([CanvasHostContext.from_dict, from_none], obj.get("host")) input = obj.get("input") session = from_union([CanvasSessionContext.from_dict, from_none], obj.get("session")) return CanvasProviderOpenRequest(canvas_id, extension_id, instance_id, session_id, host, input, session) def to_dict(self) -> dict: result: dict = {} result["canvasId"] = from_str(self.canvas_id) result["extensionId"] = from_str(self.extension_id) result["instanceId"] = from_str(self.instance_id) result["sessionId"] = from_str(self.session_id) if self.host is not None: result["host"] = from_union([lambda x: to_class(CanvasHostContext, x), from_none], self.host) if self.input is not None: result["input"] = self.input if self.session is not None: result["session"] = from_union([lambda x: to_class(CanvasSessionContext, x), from_none], self.session) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class APIKeyAuthInfo: """Schema for the `ApiKeyAuthInfo` type.""" api_key: str """The API key. Treat as a secret.""" host: str """Authentication host.""" type: ClassVar[str] = "api-key" """API-key authentication for non-GitHub LLM providers (e.g. when running BYOM-style).""" copilot_user: CopilotUserResponse | None = None """Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ @staticmethod def from_dict(obj: Any) -> 'APIKeyAuthInfo': assert isinstance(obj, dict) api_key = from_str(obj.get("apiKey")) host = from_str(obj.get("host")) copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return APIKeyAuthInfo(api_key, host, copilot_user) def to_dict(self) -> dict: result: dict = {} result["apiKey"] = from_str(self.api_key) result["host"] = from_str(self.host) result["type"] = self.type if self.copilot_user is not None: result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotAPITokenAuthInfo: """Schema for the `CopilotApiTokenAuthInfo` type.""" host: Host """Authentication host (always the public GitHub host).""" type: ClassVar[str] = "copilot-api-token" """Direct Copilot API authentication via the `GITHUB_COPILOT_API_TOKEN` + `COPILOT_API_URL` environment-variable pair. The token itself is read from the environment by the runtime, not carried in this struct. """ copilot_user: CopilotUserResponse | None = None """Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ @staticmethod def from_dict(obj: Any) -> 'CopilotAPITokenAuthInfo': assert isinstance(obj, dict) host = Host(obj.get("host")) copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return CopilotAPITokenAuthInfo(host, copilot_user) def to_dict(self) -> dict: result: dict = {} result["host"] = to_enum(Host, self.host) result["type"] = self.type if self.copilot_user is not None: result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnvAuthInfo: """Schema for the `EnvAuthInfo` type.""" env_var: str """Name of the environment variable the token was sourced from.""" host: str """Authentication host (e.g. https://github.com or a GHES host).""" token: str """The token value itself. Treat as a secret.""" type: ClassVar[str] = "env" """Personal access token (PAT) or server-to-server token sourced from an environment variable. """ copilot_user: CopilotUserResponse | None = None """Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ login: str | None = None """User login associated with the token. Undefined for server-to-server tokens (those starting with `ghs_`). """ @staticmethod def from_dict(obj: Any) -> 'EnvAuthInfo': assert isinstance(obj, dict) env_var = from_str(obj.get("envVar")) host = from_str(obj.get("host")) token = from_str(obj.get("token")) copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) login = from_union([from_str, from_none], obj.get("login")) return EnvAuthInfo(env_var, host, token, copilot_user, login) def to_dict(self) -> dict: result: dict = {} result["envVar"] = from_str(self.env_var) result["host"] = from_str(self.host) result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) if self.login is not None: result["login"] = from_union([from_str, from_none], self.login) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class GhCLIAuthInfo: """Schema for the `GhCliAuthInfo` type.""" host: str """Authentication host.""" login: str """User login as reported by `gh auth status`.""" token: str """The token returned by `gh auth token`. Treat as a secret.""" type: ClassVar[str] = "gh-cli" """Authentication via the `gh` CLI's saved credentials.""" copilot_user: CopilotUserResponse | None = None """Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ @staticmethod def from_dict(obj: Any) -> 'GhCLIAuthInfo': assert isinstance(obj, dict) host = from_str(obj.get("host")) login = from_str(obj.get("login")) token = from_str(obj.get("token")) copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return GhCLIAuthInfo(host, login, token, copilot_user) def to_dict(self) -> dict: result: dict = {} result["host"] = from_str(self.host) result["login"] = from_str(self.login) result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HMACAuthInfo: """Schema for the `HMACAuthInfo` type.""" hmac: str """HMAC secret used to sign requests.""" host: Host """Authentication host. HMAC auth always targets the public GitHub host.""" type: ClassVar[str] = "hmac" """HMAC-based authentication used by GitHub-internal services.""" copilot_user: CopilotUserResponse | None = None """Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ @staticmethod def from_dict(obj: Any) -> 'HMACAuthInfo': assert isinstance(obj, dict) hmac = from_str(obj.get("hmac")) host = Host(obj.get("host")) copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return HMACAuthInfo(hmac, host, copilot_user) def to_dict(self) -> dict: result: dict = {} result["hmac"] = from_str(self.hmac) result["host"] = to_enum(Host, self.host) result["type"] = self.type if self.copilot_user is not None: result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TokenAuthInfo: """Schema for the `TokenAuthInfo` type.""" host: str """Authentication host.""" token: str """The token value itself. Treat as a secret.""" type: ClassVar[str] = "token" """SDK-side token authentication; the host configured the token directly via the SDK.""" copilot_user: CopilotUserResponse | None = None """Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ @staticmethod def from_dict(obj: Any) -> 'TokenAuthInfo': assert isinstance(obj, dict) host = from_str(obj.get("host")) token = from_str(obj.get("token")) copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return TokenAuthInfo(host, token, copilot_user) def to_dict(self) -> dict: result: dict = {} result["host"] = from_str(self.host) result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserAuthInfo: """Schema for the `UserAuthInfo` type.""" host: str """Authentication host.""" login: str """OAuth user login.""" type: ClassVar[str] = "user" """OAuth user authentication. The token itself is held in the runtime's secret token store (keyed by host+login) and is NOT carried in this struct. """ copilot_user: CopilotUserResponse | None = None """Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ @staticmethod def from_dict(obj: Any) -> 'UserAuthInfo': assert isinstance(obj, dict) host = from_str(obj.get("host")) login = from_str(obj.get("login")) copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return UserAuthInfo(host, login, copilot_user) def to_dict(self) -> dict: result: dict = {} result["host"] = from_str(self.host) result["login"] = from_str(self.login) result["type"] = self.type if self.copilot_user is not None: result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result @dataclass class PermissionDecisionApproveForIonApproval: """Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) Schema for the `PermissionDecisionApproveForSessionApprovalCommands` type. Schema for the `PermissionDecisionApproveForSessionApprovalRead` type. Schema for the `PermissionDecisionApproveForSessionApprovalWrite` type. Schema for the `PermissionDecisionApproveForSessionApprovalMcp` type. Schema for the `PermissionDecisionApproveForSessionApprovalMcpSampling` type. Schema for the `PermissionDecisionApproveForSessionApprovalMemory` type. Schema for the `PermissionDecisionApproveForSessionApprovalCustomTool` type. Schema for the `PermissionDecisionApproveForSessionApprovalExtensionManagement` type. Schema for the `PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess` type. Approval to persist for this location Schema for the `PermissionDecisionApproveForLocationApprovalCommands` type. Schema for the `PermissionDecisionApproveForLocationApprovalRead` type. Schema for the `PermissionDecisionApproveForLocationApprovalWrite` type. Schema for the `PermissionDecisionApproveForLocationApprovalMcp` type. Schema for the `PermissionDecisionApproveForLocationApprovalMcpSampling` type. Schema for the `PermissionDecisionApproveForLocationApprovalMemory` type. Schema for the `PermissionDecisionApproveForLocationApprovalCustomTool` type. Schema for the `PermissionDecisionApproveForLocationApprovalExtensionManagement` type. Schema for the `PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess` type. The approval to add as a session-scoped rule The approval to persist for this location """ command_identifiers: list[str] | None = None """Command identifiers covered by this approval.""" kind: ApprovalKind | None = None """Approval scoped to specific command identifiers. Approval covering read-only filesystem operations. Approval covering filesystem write operations. Approval covering an MCP tool. Approval covering MCP sampling requests for a server. Approval covering writes to long-term memory. Approval covering a custom tool. Approval covering extension lifecycle operations such as enable, disable, or reload. Approval covering an extension's request to access a permission-gated capability. """ server_name: str | None = None """MCP server name.""" tool_name: str | None = None """MCP tool name, or null to cover every tool on the server. Custom tool name. """ operation: str | None = None """Optional operation identifier; when omitted, the approval covers all extension management operations. """ extension_name: str | None = None """Extension name.""" external_ref_marker_external_ref_user_tool_session_approval: str | None = None @staticmethod def from_dict(obj: Any) -> 'PermissionDecisionApproveForIonApproval': assert isinstance(obj, dict) command_identifiers = from_union([lambda x: from_list(from_str, x), from_none], obj.get("commandIdentifiers")) kind = from_union([ApprovalKind, from_none], obj.get("kind")) server_name = from_union([from_str, from_none], obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) operation = from_union([from_str, from_none], obj.get("operation")) extension_name = from_union([from_str, from_none], obj.get("extensionName")) external_ref_marker_external_ref_user_tool_session_approval = from_union([from_str, from_none], obj.get("__externalRefMarker___ExternalRef_UserToolSessionApproval")) return PermissionDecisionApproveForIonApproval(command_identifiers, kind, server_name, tool_name, operation, extension_name, external_ref_marker_external_ref_user_tool_session_approval) def to_dict(self) -> dict: result: dict = {} if self.command_identifiers is not None: result["commandIdentifiers"] = from_union([lambda x: from_list(from_str, x), from_none], self.command_identifiers) if self.kind is not None: result["kind"] = from_union([lambda x: to_enum(ApprovalKind, x), from_none], self.kind) if self.server_name is not None: result["serverName"] = from_union([from_str, from_none], self.server_name) if self.tool_name is not None: result["toolName"] = from_union([from_none, from_str], self.tool_name) if self.operation is not None: result["operation"] = from_union([from_str, from_none], self.operation) if self.extension_name is not None: result["extensionName"] = from_union([from_str, from_none], self.extension_name) if self.external_ref_marker_external_ref_user_tool_session_approval is not None: result["__externalRefMarker___ExternalRef_UserToolSessionApproval"] = from_union([from_str, from_none], self.external_ref_marker_external_ref_user_tool_session_approval) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HandlePendingToolCallRequest: """Pending external tool call request ID, with the tool result or an error describing why it failed. """ request_id: str """Request ID of the pending tool call""" error: str | None = None """Error message if the tool call failed""" result: ExternalToolTextResultForLlm | str | None = None """Tool call result (string or expanded result object)""" @staticmethod def from_dict(obj: Any) -> 'HandlePendingToolCallRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) error = from_union([from_str, from_none], obj.get("error")) result = from_union([ExternalToolTextResultForLlm.from_dict, from_str, from_none], obj.get("result")) return HandlePendingToolCallRequest(request_id, error, result) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result is not None: result["result"] = from_union([lambda x: to_class(ExternalToolTextResultForLlm, x), from_str, from_none], self.result) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPlugin: """Schema for the `InstalledPlugin` type.""" enabled: bool """Whether the plugin is currently enabled""" installed_at: str """Installation timestamp""" marketplace: str """Marketplace the plugin came from (empty string for direct repo installs)""" name: str """Plugin name""" cache_path: str | None = None """Path where the plugin is cached locally""" source: InstalledPluginSource | str | None = None """Source for direct repo installs (when marketplace is empty)""" version: str | None = None """Version installed (if available)""" @staticmethod def from_dict(obj: Any) -> 'InstalledPlugin': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) installed_at = from_str(obj.get("installed_at")) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) cache_path = from_union([from_str, from_none], obj.get("cache_path")) source = from_union([InstalledPluginSource.from_dict, from_str, from_none], obj.get("source")) version = from_union([from_str, from_none], obj.get("version")) return InstalledPlugin(enabled, installed_at, marketplace, name, cache_path, source, version) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) result["installed_at"] = from_str(self.installed_at) result["marketplace"] = from_str(self.marketplace) result["name"] = from_str(self.name) if self.cache_path is not None: result["cache_path"] = from_union([from_str, from_none], self.cache_path) if self.source is not None: result["source"] = from_union([lambda x: to_class(InstalledPluginSource, x), from_str, from_none], self.source) if self.version is not None: result["version"] = from_union([from_str, from_none], self.version) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPlugin: """Schema for the `SessionInstalledPlugin` type.""" enabled: bool """Whether the plugin is currently enabled""" installed_at: str """Installation timestamp (ISO-8601)""" marketplace: str """Marketplace the plugin came from (empty string for direct repo installs)""" name: str """Plugin name""" cache_path: str | None = None """Path where the plugin is cached locally""" source: SessionInstalledPluginSource | str | None = None """Source descriptor for direct repo installs (when marketplace is empty)""" version: str | None = None """Installed version, if known""" @staticmethod def from_dict(obj: Any) -> 'SessionInstalledPlugin': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) installed_at = from_str(obj.get("installed_at")) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) cache_path = from_union([from_str, from_none], obj.get("cache_path")) source = from_union([SessionInstalledPluginSource.from_dict, from_str, from_none], obj.get("source")) version = from_union([from_str, from_none], obj.get("version")) return SessionInstalledPlugin(enabled, installed_at, marketplace, name, cache_path, source, version) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) result["installed_at"] = from_str(self.installed_at) result["marketplace"] = from_str(self.marketplace) result["name"] = from_str(self.name) if self.cache_path is not None: result["cache_path"] = from_union([from_str, from_none], self.cache_path) if self.source is not None: result["source"] = from_union([lambda x: to_class(SessionInstalledPluginSource, x), from_str, from_none], self.source) if self.version is not None: result["version"] = from_union([from_str, from_none], self.version) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionEnrichMetadataResult: """The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. """ sessions: list[LocalSessionMetadataValue] """Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. """ @staticmethod def from_dict(obj: Any) -> 'SessionEnrichMetadataResult': assert isinstance(obj, dict) sessions = from_list(LocalSessionMetadataValue.from_dict, obj.get("sessions")) return SessionEnrichMetadataResult(sessions) def to_dict(self) -> dict: result: dict = {} result["sessions"] = from_list(lambda x: to_class(LocalSessionMetadataValue, x), self.sessions) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsEnrichMetadataRequest: """Session metadata records to enrich with summary and context information.""" sessions: list[LocalSessionMetadataValue] """Session metadata records to enrich. Records that already have summary and context are returned unchanged. """ @staticmethod def from_dict(obj: Any) -> 'SessionsEnrichMetadataRequest': assert isinstance(obj, dict) sessions = from_list(LocalSessionMetadataValue.from_dict, obj.get("sessions")) return SessionsEnrichMetadataRequest(sessions) def to_dict(self) -> dict: result: dict = {} result["sessions"] = from_list(lambda x: to_class(LocalSessionMetadataValue, x), self.sessions) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionOpenResult: """Result of opening a session.""" status: SessionsOpenStatus """Outcome of the open request.""" metadata: RemoteSessionMetadataValue | None = None """Remote session metadata, present when status is `connected`.""" progress: list[SessionsOpenProgress] | None = None """Handoff progress steps, present when status is `handed_off`.""" remote_session_id: str | None = None """Remote session ID, present when status is `connected`.""" # Internal: this field is an internal SDK API and is not part of the public surface. session_api: Any = None """In-process SessionClientApi handle for the opened session, returned to CLI callers as a transitional shortcut. Marked internal so the public SDK surface does not expose it; SDK consumers should construct per-session clients from `sessionId` instead. """ session_id: str | None = None """Opened session ID. Omitted when status is `not_found`.""" startup_prompts: list[str] | None = None """Startup prompts queued by user-level hook configs at session creation. Only populated when status is `created`; resumed sessions return an empty array. """ @staticmethod def from_dict(obj: Any) -> 'SessionOpenResult': assert isinstance(obj, dict) status = SessionsOpenStatus(obj.get("status")) metadata = from_union([RemoteSessionMetadataValue.from_dict, from_none], obj.get("metadata")) progress = from_union([lambda x: from_list(SessionsOpenProgress.from_dict, x), from_none], obj.get("progress")) remote_session_id = from_union([from_str, from_none], obj.get("remoteSessionId")) session_api = obj.get("sessionApi") session_id = from_union([from_str, from_none], obj.get("sessionId")) startup_prompts = from_union([lambda x: from_list(from_str, x), from_none], obj.get("startupPrompts")) return SessionOpenResult(status, metadata, progress, remote_session_id, session_api, session_id, startup_prompts) def to_dict(self) -> dict: result: dict = {} result["status"] = to_enum(SessionsOpenStatus, self.status) if self.metadata is not None: result["metadata"] = from_union([lambda x: to_class(RemoteSessionMetadataValue, x), from_none], self.metadata) if self.progress is not None: result["progress"] = from_union([lambda x: from_list(lambda x: to_class(SessionsOpenProgress, x), x), from_none], self.progress) if self.remote_session_id is not None: result["remoteSessionId"] = from_union([from_str, from_none], self.remote_session_id) if self.session_api is not None: result["sessionApi"] = self.session_api if self.session_id is not None: result["sessionId"] = from_union([from_str, from_none], self.session_id) if self.startup_prompts is not None: result["startupPrompts"] = from_union([lambda x: from_list(from_str, x), from_none], self.startup_prompts) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionMetadataSnapshot: """Point-in-time snapshot of slow-changing session identifier and state fields""" already_in_use: bool """True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. """ current_mode: MetadataSnapshotCurrentMode """The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot')""" is_remote: bool """Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process) """ modified_time: datetime """ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. """ session_id: str """The unique identifier of the session""" start_time: datetime """ISO 8601 timestamp of when the session started""" working_directory: str """Absolute path to the session's current working directory""" client_name: str | None = None """Runtime client name associated with the session (telemetry identifier).""" initial_name: str | None = None """User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. """ remote_metadata: MetadataSnapshotRemoteMetadata | None = None """Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. """ selected_model: str | None = None """Currently selected model identifier, if any""" session_limits: SessionLimitsConfig | None = None """Current session limits, or null when no limits are active""" summary: str | None = None """Short human-readable summary of the session, if known. Omitted when no summary has been generated. """ workspace: WorkspaceSummary | None = None """Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). """ workspace_path: str | None = None """Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace """ @staticmethod def from_dict(obj: Any) -> 'SessionMetadataSnapshot': assert isinstance(obj, dict) already_in_use = from_bool(obj.get("alreadyInUse")) current_mode = MetadataSnapshotCurrentMode(obj.get("currentMode")) is_remote = from_bool(obj.get("isRemote")) modified_time = from_datetime(obj.get("modifiedTime")) session_id = from_str(obj.get("sessionId")) start_time = from_datetime(obj.get("startTime")) working_directory = from_str(obj.get("workingDirectory")) client_name = from_union([from_str, from_none], obj.get("clientName")) initial_name = from_union([from_str, from_none], obj.get("initialName")) remote_metadata = from_union([MetadataSnapshotRemoteMetadata.from_dict, from_none], obj.get("remoteMetadata")) selected_model = from_union([from_str, from_none], obj.get("selectedModel")) session_limits = from_union([SessionLimitsConfig.from_dict, from_none], obj.get("sessionLimits")) summary = from_union([from_str, from_none], obj.get("summary")) workspace = from_union([WorkspaceSummary.from_dict, from_none], obj.get("workspace")) workspace_path = from_union([from_none, from_str], obj.get("workspacePath")) return SessionMetadataSnapshot(already_in_use, current_mode, is_remote, modified_time, session_id, start_time, working_directory, client_name, initial_name, remote_metadata, selected_model, session_limits, summary, workspace, workspace_path) def to_dict(self) -> dict: result: dict = {} result["alreadyInUse"] = from_bool(self.already_in_use) result["currentMode"] = to_enum(MetadataSnapshotCurrentMode, self.current_mode) result["isRemote"] = from_bool(self.is_remote) result["modifiedTime"] = self.modified_time.isoformat() result["sessionId"] = from_str(self.session_id) result["startTime"] = self.start_time.isoformat() result["workingDirectory"] = from_str(self.working_directory) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.initial_name is not None: result["initialName"] = from_union([from_str, from_none], self.initial_name) if self.remote_metadata is not None: result["remoteMetadata"] = from_union([lambda x: to_class(MetadataSnapshotRemoteMetadata, x), from_none], self.remote_metadata) if self.selected_model is not None: result["selectedModel"] = from_union([from_str, from_none], self.selected_model) result["sessionLimits"] = from_union([lambda x: to_class(SessionLimitsConfig, x), from_none], self.session_limits) if self.summary is not None: result["summary"] = from_union([from_str, from_none], self.summary) if self.workspace is not None: result["workspace"] = from_union([lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace) result["workspacePath"] = from_union([from_none, from_str], self.workspace_path) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderModelConfig: """A BYOK model definition referencing a named provider.""" id: str """Provider-local model id, unique within its provider. The session-wide selection id (shown in the model list and passed to switchTo) is the provider-qualified `provider/id`. """ provider: str """Name of the NamedProviderConfig that serves this model.""" capabilities: ModelCapabilitiesOverride | None = None """Optional capability overrides (vision, tool_calls, reasoning, etc.).""" max_context_window_tokens: float | None = None """Maximum context window tokens for the model.""" max_output_tokens: float | None = None """Maximum output tokens for the model.""" max_prompt_tokens: float | None = None """Maximum prompt/input tokens for the model.""" model_id: str | None = None """Well-known base model id used for behavior/capability/config lookup. Defaults to `id`.""" name: str | None = None """Display name for model pickers. Defaults to the provider-qualified selection id (`provider/id`). """ wire_model: str | None = None """The model name sent to the provider API for inference. Defaults to `id`.""" @staticmethod def from_dict(obj: Any) -> 'ProviderModelConfig': assert isinstance(obj, dict) id = from_str(obj.get("id")) provider = from_str(obj.get("provider")) capabilities = from_union([ModelCapabilitiesOverride.from_dict, from_none], obj.get("capabilities")) max_context_window_tokens = from_union([from_float, from_none], obj.get("maxContextWindowTokens")) max_output_tokens = from_union([from_float, from_none], obj.get("maxOutputTokens")) max_prompt_tokens = from_union([from_float, from_none], obj.get("maxPromptTokens")) model_id = from_union([from_str, from_none], obj.get("modelId")) name = from_union([from_str, from_none], obj.get("name")) wire_model = from_union([from_str, from_none], obj.get("wireModel")) return ProviderModelConfig(id, provider, capabilities, max_context_window_tokens, max_output_tokens, max_prompt_tokens, model_id, name, wire_model) def to_dict(self) -> dict: result: dict = {} result["id"] = from_str(self.id) result["provider"] = from_str(self.provider) if self.capabilities is not None: result["capabilities"] = from_union([lambda x: to_class(ModelCapabilitiesOverride, x), from_none], self.capabilities) if self.max_context_window_tokens is not None: result["maxContextWindowTokens"] = from_union([to_float, from_none], self.max_context_window_tokens) if self.max_output_tokens is not None: result["maxOutputTokens"] = from_union([to_float, from_none], self.max_output_tokens) if self.max_prompt_tokens is not None: result["maxPromptTokens"] = from_union([to_float, from_none], self.max_prompt_tokens) if self.model_id is not None: result["modelId"] = from_union([from_str, from_none], self.model_id) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.wire_model is not None: result["wireModel"] = from_union([from_str, from_none], self.wire_model) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureParams: """Patch of permission policy fields to apply (omit a field to leave it unchanged).""" additional_content_exclusion_policies: list[PermissionsConfigureAdditionalContentExclusionPolicy] | None = None """If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. """ approve_all_read_permission_requests: bool | None = None """If specified, sets whether path/URL read permission requests are auto-approved. Omit to leave the current value unchanged. """ approve_all_tool_permission_requests: bool | None = None """If specified, sets whether tool permission requests are auto-approved without prompting. Omit to leave the current value unchanged. """ paths: PermissionPathsConfig | None = None """If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. """ rules: PermissionRulesSet | None = None """If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. """ urls: PermissionUrlsConfig | None = None """If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. """ @staticmethod def from_dict(obj: Any) -> 'PermissionsConfigureParams': assert isinstance(obj, dict) additional_content_exclusion_policies = from_union([lambda x: from_list(PermissionsConfigureAdditionalContentExclusionPolicy.from_dict, x), from_none], obj.get("additionalContentExclusionPolicies")) approve_all_read_permission_requests = from_union([from_bool, from_none], obj.get("approveAllReadPermissionRequests")) approve_all_tool_permission_requests = from_union([from_bool, from_none], obj.get("approveAllToolPermissionRequests")) paths = from_union([PermissionPathsConfig.from_dict, from_none], obj.get("paths")) rules = from_union([PermissionRulesSet.from_dict, from_none], obj.get("rules")) urls = from_union([PermissionUrlsConfig.from_dict, from_none], obj.get("urls")) return PermissionsConfigureParams(additional_content_exclusion_policies, approve_all_read_permission_requests, approve_all_tool_permission_requests, paths, rules, urls) def to_dict(self) -> dict: result: dict = {} if self.additional_content_exclusion_policies is not None: result["additionalContentExclusionPolicies"] = from_union([lambda x: from_list(lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicy, x), x), from_none], self.additional_content_exclusion_policies) if self.approve_all_read_permission_requests is not None: result["approveAllReadPermissionRequests"] = from_union([from_bool, from_none], self.approve_all_read_permission_requests) if self.approve_all_tool_permission_requests is not None: result["approveAllToolPermissionRequests"] = from_union([from_bool, from_none], self.approve_all_tool_permission_requests) if self.paths is not None: result["paths"] = from_union([lambda x: to_class(PermissionPathsConfig, x), from_none], self.paths) if self.rules is not None: result["rules"] = from_union([lambda x: to_class(PermissionRulesSet, x), from_none], self.rules) if self.urls is not None: result["urls"] = from_union([lambda x: to_class(PermissionUrlsConfig, x), from_none], self.urls) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SandboxConfig: """Resolved sandbox configuration.""" enabled: bool """Whether sandboxing is enabled for the session.""" add_current_working_directory: bool | None = None """Whether to auto-add the current working directory to readwritePaths. Default: true.""" user_policy: SandboxConfigUserPolicy | None = None """User-managed sandbox policy fragment merged into the auto-discovered base policy.""" @staticmethod def from_dict(obj: Any) -> 'SandboxConfig': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) add_current_working_directory = from_union([from_bool, from_none], obj.get("addCurrentWorkingDirectory")) user_policy = from_union([SandboxConfigUserPolicy.from_dict, from_none], obj.get("userPolicy")) return SandboxConfig(enabled, add_current_working_directory, user_policy) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) if self.add_current_working_directory is not None: result["addCurrentWorkingDirectory"] = from_union([from_bool, from_none], self.add_current_working_directory) if self.user_policy is not None: result["userPolicy"] = from_union([lambda x: to_class(SandboxConfigUserPolicy, x), from_none], self.user_policy) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetProgressResult: """Progress information for the task, or null when no task with that ID is tracked.""" progress: TaskProgress | None = None """Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. """ @staticmethod def from_dict(obj: Any) -> 'TasksGetProgressResult': assert isinstance(obj, dict) progress = from_union([TaskProgress.from_dict, from_none], obj.get("progress")) return TasksGetProgressResult(progress) def to_dict(self) -> dict: result: dict = {} if self.progress is not None: result["progress"] = from_union([lambda x: to_class(TaskProgress, x), from_none], self.progress) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchema: """JSON Schema describing the form fields to present to the user""" properties: dict[str, UIElicitationSchemaProperty] """Form field definitions, keyed by field name""" type: UIElicitationSchemaType """Schema type indicator (always 'object')""" required: list[str] | None = None """List of required field names""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationSchema': assert isinstance(obj, dict) properties = from_dict(UIElicitationSchemaProperty.from_dict, obj.get("properties")) type = UIElicitationSchemaType(obj.get("type")) required = from_union([lambda x: from_list(from_str, x), from_none], obj.get("required")) return UIElicitationSchema(properties, type, required) def to_dict(self) -> dict: result: dict = {} result["properties"] = from_dict(lambda x: to_class(UIElicitationSchemaProperty, x), self.properties) result["type"] = to_enum(UIElicitationSchemaType, self.type) if self.required is not None: result["required"] = from_union([lambda x: from_list(from_str, x), from_none], self.required) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSetAdditionalPluginsRequest: """Manager-wide additional plugins to register; replaces any previously-configured set.""" plugins: list[InstalledPlugin] """Manager-wide additional plugins to register. Replaces any previously-configured set. Pass an empty array to clear. """ @staticmethod def from_dict(obj: Any) -> 'SessionsSetAdditionalPluginsRequest': assert isinstance(obj, dict) plugins = from_list(InstalledPlugin.from_dict, obj.get("plugins")) return SessionsSetAdditionalPluginsRequest(plugins) def to_dict(self) -> dict: result: dict = {} result["plugins"] = from_list(lambda x: to_class(InstalledPlugin, x), self.plugins) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderAddRequest: """BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both. """ models: list[ProviderModelConfig] | None = None """BYOK model definitions to register. Each must reference a provider that is already registered or included in this same call. Selection ids (`provider/id`) must be unique across the registry. """ providers: list[NamedProviderConfig] | None = None """Named BYOK provider connections to register, additive to any providers already in the registry. Each name must be unique across the registry and must not contain '/'. """ @staticmethod def from_dict(obj: Any) -> 'ProviderAddRequest': assert isinstance(obj, dict) models = from_union([lambda x: from_list(ProviderModelConfig.from_dict, x), from_none], obj.get("models")) providers = from_union([lambda x: from_list(NamedProviderConfig.from_dict, x), from_none], obj.get("providers")) return ProviderAddRequest(models, providers) def to_dict(self) -> dict: result: dict = {} if self.models is not None: result["models"] = from_union([lambda x: from_list(lambda x: to_class(ProviderModelConfig, x), x), from_none], self.models) if self.providers is not None: result["providers"] = from_union([lambda x: from_list(lambda x: to_class(NamedProviderConfig, x), x), from_none], self.providers) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionOpenOptions: """Session construction options. Session resume options. Session options for the connection. Session options for cloud session creation. Session construction options for the new local session. """ additional_content_exclusion_policies: list[SessionOpenOptionsAdditionalContentExclusionPolicy] | None = None """Additional content-exclusion policies to merge into the session policy set.""" agent_context: str | None = None """Runtime context discriminator for agent filtering.""" allow_all_mcp_server_instructions: bool | None = None """Whether to include instructions from every MCP server in the system prompt instead of only allowlisted servers. """ ask_user_disabled: bool | None = None """Whether ask_user is explicitly disabled.""" auth_info: AuthInfo | None = None """Initial authentication info for the session.""" available_tools: list[str] | None = None """Allowlist of available tool names.""" capi: CapiSessionOptions | None = None """Options scoped to the built-in CAPI (Copilot API) provider.""" client_kind: str | None = None """Structured client kind used for runtime behavior gates.""" client_name: str | None = None """Identifier of the client driving the session.""" coauthor_enabled: bool | None = None """Whether commit-message coauthor trailers are enabled.""" config_dir: str | None = None """Override Copilot configuration directory.""" continue_on_auto_mode: bool | None = None """Whether auto-mode continuation is enabled.""" copilot_url: str | None = None """Override URL for the Copilot API endpoint.""" custom_agents_local_only: bool | None = None """Whether custom agents default to local-only execution.""" detached_from_spawning_parent_engagement_id: str | None = None """Parent engagement ID for detached child telemetry rollup.""" detached_from_spawning_parent_session_id: str | None = None """Parent session ID for detached child telemetry rollup.""" disabled_instruction_sources: list[str] | None = None """Instruction source IDs disabled for this session.""" disabled_skills: list[str] | None = None """Skill IDs disabled for this session.""" enable_citations: bool | None = None """Experimental: enable native model citations (Anthropic models today), normalized onto the `assistant.message` event. Off by default; may change or be removed while the citations surface is experimental. """ enable_on_demand_instruction_discovery: bool | None = None """Whether on-demand custom instruction discovery is enabled.""" enable_script_safety: bool | None = None """Whether shell-script safety heuristics are enabled.""" enable_streaming: bool | None = None """Whether model responses stream as delta events.""" env_value_mode: MCPSetEnvValueModeDetails | None = None """How MCP server environment values are interpreted.""" events_log_directory: str | None = None """Override directory for session event logs.""" excluded_builtin_agents: list[str] | None = None """Built-in subagent names to exclude from this session. Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a custom agent with the same name is available. """ excluded_tools: list[str] | None = None """Denylist of tool names.""" # Internal: this field is an internal SDK API and is not part of the public surface. exp_assignments: Any = None """ExP assignment ('flight') data injected by an SDK integrator, in the same JSON shape the Copilot CLI fetches from the experimentation service (CopilotExpAssignmentResponse). When supplied this is fed into the FeatureFlagService exactly like CLI-fetched assignments and ExP-backed flags wait for it. When absent the session does not block on ExP. """ feature_flags: dict[str, bool] | None = None """Feature-flag values resolved by the host.""" installed_plugins: list[InstalledPlugin] | None = None """Installed plugins visible to the session.""" integration_id: str | None = None """Stable integration identifier for analytics.""" is_experimental_mode: bool | None = None """Whether experimental behavior is enabled.""" log_interactive_shells: bool | None = None """Whether interactive shell sessions are logged.""" lsp_client_name: str | None = None """Identifier sent to LSP-style integrations.""" max_inline_binary_bytes: int | None = None """Maximum decoded byte size of a single inline model-facing binary tool result persisted in session events (default 10 MB). """ memory: MemoryConfiguration | None = None """Memory configuration for this session.""" model: str | None = None """Initial model identifier.""" model_capabilities_overrides: ModelCapabilitiesOverride | None = None """Initial model capability overrides.""" models: list[ProviderModelConfig] | None = None """BYOK model definitions added to the selectable model list, each referencing a provider name. """ name: str | None = None """Optional human-friendly session name.""" provider: ProviderConfig | None = None """Custom model-provider configuration (BYOK).""" providers: list[NamedProviderConfig] | None = None """Named BYOK provider connections, additive to CAPI auth. Combining with `provider` is rejected. """ reasoning_effort: str | None = None """Initial reasoning effort level.""" reasoning_summary: ReasoningSummary | None = None """Initial reasoning summary mode for supported model clients.""" remote_defaulted_on: bool | None = None """Telemetry-only remote-defaulted flag.""" remote_exporting: bool | None = None """Telemetry-only remote exporting flag.""" remote_steerable: bool | None = None """Whether this session supports remote steering.""" running_in_interactive_mode: bool | None = None """Whether the host is an interactive UI.""" sandbox_config: SandboxConfig | None = None """Resolved sandbox configuration.""" session_capabilities: list[SessionCapability] | None = None """Capabilities enabled for this session.""" session_id: str | None = None """Optional stable session identifier to use for a new session.""" session_limits: SessionLimitsConfig | None = None """Initial session limits.""" shell_init_profile: str | None = None """Shell init profile.""" shell_process_flags: list[str] | None = None """Per-shell process flags.""" skill_directories: list[str] | None = None """Additional directories to search for skills.""" skip_custom_instructions: bool | None = None """Whether to skip custom instruction sources.""" trajectory_file: str | None = None """Optional trajectory output file path.""" working_directory: str | None = None """Working directory to anchor the session.""" working_directory_context: SessionContext | None = None """Pre-resolved working-directory context for session startup.""" @staticmethod def from_dict(obj: Any) -> 'SessionOpenOptions': assert isinstance(obj, dict) additional_content_exclusion_policies = from_union([lambda x: from_list(SessionOpenOptionsAdditionalContentExclusionPolicy.from_dict, x), from_none], obj.get("additionalContentExclusionPolicies")) agent_context = from_union([from_str, from_none], obj.get("agentContext")) allow_all_mcp_server_instructions = from_union([from_bool, from_none], obj.get("allowAllMcpServerInstructions")) ask_user_disabled = from_union([from_bool, from_none], obj.get("askUserDisabled")) auth_info = from_union([_load_AuthInfo, from_none], obj.get("authInfo")) available_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("availableTools")) capi = from_union([CapiSessionOptions.from_dict, from_none], obj.get("capi")) client_kind = from_union([from_str, from_none], obj.get("clientKind")) client_name = from_union([from_str, from_none], obj.get("clientName")) coauthor_enabled = from_union([from_bool, from_none], obj.get("coauthorEnabled")) config_dir = from_union([from_str, from_none], obj.get("configDir")) continue_on_auto_mode = from_union([from_bool, from_none], obj.get("continueOnAutoMode")) copilot_url = from_union([from_str, from_none], obj.get("copilotUrl")) custom_agents_local_only = from_union([from_bool, from_none], obj.get("customAgentsLocalOnly")) detached_from_spawning_parent_engagement_id = from_union([from_str, from_none], obj.get("detachedFromSpawningParentEngagementId")) detached_from_spawning_parent_session_id = from_union([from_str, from_none], obj.get("detachedFromSpawningParentSessionId")) disabled_instruction_sources = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledInstructionSources")) disabled_skills = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledSkills")) enable_citations = from_union([from_bool, from_none], obj.get("enableCitations")) enable_on_demand_instruction_discovery = from_union([from_bool, from_none], obj.get("enableOnDemandInstructionDiscovery")) enable_script_safety = from_union([from_bool, from_none], obj.get("enableScriptSafety")) enable_streaming = from_union([from_bool, from_none], obj.get("enableStreaming")) env_value_mode = from_union([MCPSetEnvValueModeDetails, from_none], obj.get("envValueMode")) events_log_directory = from_union([from_str, from_none], obj.get("eventsLogDirectory")) excluded_builtin_agents = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludedBuiltinAgents")) excluded_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludedTools")) exp_assignments = obj.get("expAssignments") feature_flags = from_union([lambda x: from_dict(from_bool, x), from_none], obj.get("featureFlags")) installed_plugins = from_union([lambda x: from_list(InstalledPlugin.from_dict, x), from_none], obj.get("installedPlugins")) integration_id = from_union([from_str, from_none], obj.get("integrationId")) is_experimental_mode = from_union([from_bool, from_none], obj.get("isExperimentalMode")) log_interactive_shells = from_union([from_bool, from_none], obj.get("logInteractiveShells")) lsp_client_name = from_union([from_str, from_none], obj.get("lspClientName")) max_inline_binary_bytes = from_union([from_int, from_none], obj.get("maxInlineBinaryBytes")) memory = from_union([MemoryConfiguration.from_dict, from_none], obj.get("memory")) model = from_union([from_str, from_none], obj.get("model")) model_capabilities_overrides = from_union([ModelCapabilitiesOverride.from_dict, from_none], obj.get("modelCapabilitiesOverrides")) models = from_union([lambda x: from_list(ProviderModelConfig.from_dict, x), from_none], obj.get("models")) name = from_union([from_str, from_none], obj.get("name")) provider = from_union([ProviderConfig.from_dict, from_none], obj.get("provider")) providers = from_union([lambda x: from_list(NamedProviderConfig.from_dict, x), from_none], obj.get("providers")) reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) reasoning_summary = from_union([ReasoningSummary, from_none], obj.get("reasoningSummary")) remote_defaulted_on = from_union([from_bool, from_none], obj.get("remoteDefaultedOn")) remote_exporting = from_union([from_bool, from_none], obj.get("remoteExporting")) remote_steerable = from_union([from_bool, from_none], obj.get("remoteSteerable")) running_in_interactive_mode = from_union([from_bool, from_none], obj.get("runningInInteractiveMode")) sandbox_config = from_union([SandboxConfig.from_dict, from_none], obj.get("sandboxConfig")) session_capabilities = from_union([lambda x: from_list(SessionCapability, x), from_none], obj.get("sessionCapabilities")) session_id = from_union([from_str, from_none], obj.get("sessionId")) session_limits = from_union([SessionLimitsConfig.from_dict, from_none], obj.get("sessionLimits")) shell_init_profile = from_union([from_str, from_none], obj.get("shellInitProfile")) shell_process_flags = from_union([lambda x: from_list(from_str, x), from_none], obj.get("shellProcessFlags")) skill_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories")) skip_custom_instructions = from_union([from_bool, from_none], obj.get("skipCustomInstructions")) trajectory_file = from_union([from_str, from_none], obj.get("trajectoryFile")) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) working_directory_context = from_union([SessionContext.from_dict, from_none], obj.get("workingDirectoryContext")) return SessionOpenOptions(additional_content_exclusion_policies, agent_context, allow_all_mcp_server_instructions, ask_user_disabled, auth_info, available_tools, capi, client_kind, client_name, coauthor_enabled, config_dir, continue_on_auto_mode, copilot_url, custom_agents_local_only, detached_from_spawning_parent_engagement_id, detached_from_spawning_parent_session_id, disabled_instruction_sources, disabled_skills, enable_citations, enable_on_demand_instruction_discovery, enable_script_safety, enable_streaming, env_value_mode, events_log_directory, excluded_builtin_agents, excluded_tools, exp_assignments, feature_flags, installed_plugins, integration_id, is_experimental_mode, log_interactive_shells, lsp_client_name, max_inline_binary_bytes, memory, model, model_capabilities_overrides, models, name, provider, providers, reasoning_effort, reasoning_summary, remote_defaulted_on, remote_exporting, remote_steerable, running_in_interactive_mode, sandbox_config, session_capabilities, session_id, session_limits, shell_init_profile, shell_process_flags, skill_directories, skip_custom_instructions, trajectory_file, working_directory, working_directory_context) def to_dict(self) -> dict: result: dict = {} if self.additional_content_exclusion_policies is not None: result["additionalContentExclusionPolicies"] = from_union([lambda x: from_list(lambda x: to_class(SessionOpenOptionsAdditionalContentExclusionPolicy, x), x), from_none], self.additional_content_exclusion_policies) if self.agent_context is not None: result["agentContext"] = from_union([from_str, from_none], self.agent_context) if self.allow_all_mcp_server_instructions is not None: result["allowAllMcpServerInstructions"] = from_union([from_bool, from_none], self.allow_all_mcp_server_instructions) if self.ask_user_disabled is not None: result["askUserDisabled"] = from_union([from_bool, from_none], self.ask_user_disabled) if self.auth_info is not None: result["authInfo"] = from_union([lambda x: (x).to_dict(), from_none], self.auth_info) if self.available_tools is not None: result["availableTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.available_tools) if self.capi is not None: result["capi"] = from_union([lambda x: to_class(CapiSessionOptions, x), from_none], self.capi) if self.client_kind is not None: result["clientKind"] = from_union([from_str, from_none], self.client_kind) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.coauthor_enabled is not None: result["coauthorEnabled"] = from_union([from_bool, from_none], self.coauthor_enabled) if self.config_dir is not None: result["configDir"] = from_union([from_str, from_none], self.config_dir) if self.continue_on_auto_mode is not None: result["continueOnAutoMode"] = from_union([from_bool, from_none], self.continue_on_auto_mode) if self.copilot_url is not None: result["copilotUrl"] = from_union([from_str, from_none], self.copilot_url) if self.custom_agents_local_only is not None: result["customAgentsLocalOnly"] = from_union([from_bool, from_none], self.custom_agents_local_only) if self.detached_from_spawning_parent_engagement_id is not None: result["detachedFromSpawningParentEngagementId"] = from_union([from_str, from_none], self.detached_from_spawning_parent_engagement_id) if self.detached_from_spawning_parent_session_id is not None: result["detachedFromSpawningParentSessionId"] = from_union([from_str, from_none], self.detached_from_spawning_parent_session_id) if self.disabled_instruction_sources is not None: result["disabledInstructionSources"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_instruction_sources) if self.disabled_skills is not None: result["disabledSkills"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_skills) if self.enable_citations is not None: result["enableCitations"] = from_union([from_bool, from_none], self.enable_citations) if self.enable_on_demand_instruction_discovery is not None: result["enableOnDemandInstructionDiscovery"] = from_union([from_bool, from_none], self.enable_on_demand_instruction_discovery) if self.enable_script_safety is not None: result["enableScriptSafety"] = from_union([from_bool, from_none], self.enable_script_safety) if self.enable_streaming is not None: result["enableStreaming"] = from_union([from_bool, from_none], self.enable_streaming) if self.env_value_mode is not None: result["envValueMode"] = from_union([lambda x: to_enum(MCPSetEnvValueModeDetails, x), from_none], self.env_value_mode) if self.events_log_directory is not None: result["eventsLogDirectory"] = from_union([from_str, from_none], self.events_log_directory) if self.excluded_builtin_agents is not None: result["excludedBuiltinAgents"] = from_union([lambda x: from_list(from_str, x), from_none], self.excluded_builtin_agents) if self.excluded_tools is not None: result["excludedTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.excluded_tools) if self.exp_assignments is not None: result["expAssignments"] = self.exp_assignments if self.feature_flags is not None: result["featureFlags"] = from_union([lambda x: from_dict(from_bool, x), from_none], self.feature_flags) if self.installed_plugins is not None: result["installedPlugins"] = from_union([lambda x: from_list(lambda x: to_class(InstalledPlugin, x), x), from_none], self.installed_plugins) if self.integration_id is not None: result["integrationId"] = from_union([from_str, from_none], self.integration_id) if self.is_experimental_mode is not None: result["isExperimentalMode"] = from_union([from_bool, from_none], self.is_experimental_mode) if self.log_interactive_shells is not None: result["logInteractiveShells"] = from_union([from_bool, from_none], self.log_interactive_shells) if self.lsp_client_name is not None: result["lspClientName"] = from_union([from_str, from_none], self.lsp_client_name) if self.max_inline_binary_bytes is not None: result["maxInlineBinaryBytes"] = from_union([from_int, from_none], self.max_inline_binary_bytes) if self.memory is not None: result["memory"] = from_union([lambda x: to_class(MemoryConfiguration, x), from_none], self.memory) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.model_capabilities_overrides is not None: result["modelCapabilitiesOverrides"] = from_union([lambda x: to_class(ModelCapabilitiesOverride, x), from_none], self.model_capabilities_overrides) if self.models is not None: result["models"] = from_union([lambda x: from_list(lambda x: to_class(ProviderModelConfig, x), x), from_none], self.models) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.provider is not None: result["provider"] = from_union([lambda x: to_class(ProviderConfig, x), from_none], self.provider) if self.providers is not None: result["providers"] = from_union([lambda x: from_list(lambda x: to_class(NamedProviderConfig, x), x), from_none], self.providers) if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) if self.reasoning_summary is not None: result["reasoningSummary"] = from_union([lambda x: to_enum(ReasoningSummary, x), from_none], self.reasoning_summary) if self.remote_defaulted_on is not None: result["remoteDefaultedOn"] = from_union([from_bool, from_none], self.remote_defaulted_on) if self.remote_exporting is not None: result["remoteExporting"] = from_union([from_bool, from_none], self.remote_exporting) if self.remote_steerable is not None: result["remoteSteerable"] = from_union([from_bool, from_none], self.remote_steerable) if self.running_in_interactive_mode is not None: result["runningInInteractiveMode"] = from_union([from_bool, from_none], self.running_in_interactive_mode) if self.sandbox_config is not None: result["sandboxConfig"] = from_union([lambda x: to_class(SandboxConfig, x), from_none], self.sandbox_config) if self.session_capabilities is not None: result["sessionCapabilities"] = from_union([lambda x: from_list(lambda x: to_enum(SessionCapability, x), x), from_none], self.session_capabilities) if self.session_id is not None: result["sessionId"] = from_union([from_str, from_none], self.session_id) if self.session_limits is not None: result["sessionLimits"] = from_union([lambda x: to_class(SessionLimitsConfig, x), from_none], self.session_limits) if self.shell_init_profile is not None: result["shellInitProfile"] = from_union([from_str, from_none], self.shell_init_profile) if self.shell_process_flags is not None: result["shellProcessFlags"] = from_union([lambda x: from_list(from_str, x), from_none], self.shell_process_flags) if self.skill_directories is not None: result["skillDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.skill_directories) if self.skip_custom_instructions is not None: result["skipCustomInstructions"] = from_union([from_bool, from_none], self.skip_custom_instructions) if self.trajectory_file is not None: result["trajectoryFile"] = from_union([from_str, from_none], self.trajectory_file) if self.working_directory is not None: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) if self.working_directory_context is not None: result["workingDirectoryContext"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.working_directory_context) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionUpdateOptionsParams: """Patch of mutable session options to apply to the running session.""" additional_content_exclusion_policies: list[OptionsUpdateAdditionalContentExclusionPolicy] | None = None """Additional content-exclusion policies to merge into the session's policy set.""" agent_context: str | None = None """Runtime context discriminator (e.g., `cli`, `actions`).""" allow_all_mcp_server_instructions: bool | None = None """Whether to include instructions from every MCP server in the system prompt instead of only allowlisted servers. """ ask_user_disabled: bool | None = None """Whether to disable the `ask_user` tool (encourages autonomous behavior).""" available_tools: list[str] | None = None """Allowlist of tool names available to this session.""" capi: CapiSessionOptions | None = None """Options scoped to the built-in CAPI (Copilot API) provider.""" client_name: str | None = None """Identifier of the client driving the session.""" coauthor_enabled: bool | None = None """Whether to include the `Co-authored-by` trailer in commit messages.""" context_tier: OptionsUpdateContextTier | None = None """Context tier for models with tiered pricing. The session uses this to derive effective `modelCapabilitiesOverrides` so compaction, truncation, token display, and request limits honor the selected tier. """ continue_on_auto_mode: bool | None = None """Whether to allow auto-mode continuation across turns.""" copilot_url: str | None = None """Override URL for the Copilot API endpoint.""" custom_agents_local_only: bool | None = None """Whether to default custom agents to local-only execution.""" disabled_instruction_sources: list[str] | None = None """Instruction source IDs to exclude from the system prompt.""" disabled_skills: list[str] | None = None """Skill IDs that should be excluded from this session.""" enable_file_hooks: bool | None = None """Whether to enable loading of `.github/hooks/` filesystem hooks. Separate from the SDK callback hook mechanism. """ enable_host_git_operations: bool | None = None """Whether to enable host git operations (context resolution, child repo scanning, git info in system prompt). """ enable_on_demand_instruction_discovery: bool | None = None """Whether to discover custom instructions on demand after successful file views (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md surfacing). Combined with `skipCustomInstructions` and the runtime-side `ON_DEMAND_INSTRUCTIONS` feature flag. """ enable_reasoning_summaries: bool | None = None """Whether to surface reasoning-summary events from the model.""" enable_script_safety: bool | None = None """Whether shell-script safety heuristics are enabled.""" enable_session_store: bool | None = None """Whether to enable cross-session store writes and reads.""" enable_skills: bool | None = None """Whether to enable skill directory scanning and loading. Falls back to enableConfigDiscovery when unset. """ enable_streaming: bool | None = None """Whether to stream model responses.""" env_value_mode: MCPSetEnvValueModeDetails | None = None """How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). """ events_log_directory: str | None = None """Override directory for the session-events log. When unset, the runtime's default events log directory is used. """ excluded_builtin_agents: list[str] | None = None """Built-in subagent names to exclude from this session. Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a custom agent with the same name is available. """ excluded_tools: list[str] | None = None """Denylist of tool names for this session.""" feature_flags: dict[str, bool] | None = None """Map of feature-flag IDs to their boolean enabled state.""" installed_plugins: list[SessionInstalledPlugin] | None = None """Full set of installed plugins for the session. Replaces the existing list; the runtime invalidates the skills cache only when the list materially changes. """ integration_id: str | None = None """Stable integration identifier used for analytics and rate-limit attribution.""" is_experimental_mode: bool | None = None """Whether experimental capabilities are enabled.""" log_interactive_shells: bool | None = None """Whether interactive shell sessions are logged.""" lsp_client_name: str | None = None """Identifier sent to LSP-style integrations.""" manage_schedule_enabled: bool | None = None """Whether to expose the `manage_schedule` tool to the agent. The runtime always owns the per-session schedule registry; this flag only controls tool exposure (typically gated to staff users). """ max_inline_binary_bytes: int | None = None """Maximum decoded byte size of a single model-facing binary tool result (e.g. an image) persisted inline in session events and re-presented to the model on later turns / resume. Larger results are persisted as a metadata-only marker and shown to the model as a short text note. Defaults to 10 MB. """ model: str | None = None """The model ID to use for assistant turns.""" model_capabilities_overrides: ModelCapabilitiesOverride | None = None """Per-property model capability overrides for the selected model.""" organization_custom_instructions: str | None = None """Organization-level custom instructions to inject into the system prompt.""" provider: ProviderConfig | None = None """Custom model-provider configuration (BYOK).""" reasoning_effort: str | None = None """Reasoning effort for the selected model (model-defined enum).""" reasoning_summary: ReasoningSummary | None = None """Reasoning summary mode for supported model clients.""" running_in_interactive_mode: bool | None = None """Whether the session is running in an interactive UI.""" sandbox_config: SandboxConfig | None = None """Resolved sandbox configuration.""" session_capabilities: list[SessionCapability] | None = None """Replaces the session's capability set with the given list. Use to enable or disable capabilities mid-session (e.g., remove `memory` for reproducible scripted runs). Omit the field to leave the existing capability set unchanged. """ session_limits: SessionLimitsConfig | None = None """Optional session limits. Pass null to clear the session limits.""" shell_init_profile: str | None = None """Shell init profile (`None` or `NonInteractive`).""" shell_process_flags: list[str] | None = None """Per-shell process flags (e.g., `pwsh` arguments).""" skill_directories: list[str] | None = None """Additional directories to search for skills.""" skip_custom_instructions: bool | None = None """Whether to skip loading custom instruction sources.""" skip_embedding_retrieval: bool | None = None """Whether to skip embedding retrieval pipeline initialization and execution.""" suppress_custom_agent_prompt: bool | None = None """When true, the selected custom agent's prompt is not injected into the user message (skill context is still injected). Used by automation triggers where the agent prompt is already in the problem statement. """ tool_filter_precedence: OptionsUpdateToolFilterPrecedence | None = None """Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. """ trajectory_file: str | None = None """Optional path for trajectory output.""" working_directory: str | None = None """Absolute working-directory path for shell tools.""" @staticmethod def from_dict(obj: Any) -> 'SessionUpdateOptionsParams': assert isinstance(obj, dict) additional_content_exclusion_policies = from_union([lambda x: from_list(OptionsUpdateAdditionalContentExclusionPolicy.from_dict, x), from_none], obj.get("additionalContentExclusionPolicies")) agent_context = from_union([from_str, from_none], obj.get("agentContext")) allow_all_mcp_server_instructions = from_union([from_bool, from_none], obj.get("allowAllMcpServerInstructions")) ask_user_disabled = from_union([from_bool, from_none], obj.get("askUserDisabled")) available_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("availableTools")) capi = from_union([CapiSessionOptions.from_dict, from_none], obj.get("capi")) client_name = from_union([from_str, from_none], obj.get("clientName")) coauthor_enabled = from_union([from_bool, from_none], obj.get("coauthorEnabled")) context_tier = from_union([OptionsUpdateContextTier, from_none], obj.get("contextTier")) continue_on_auto_mode = from_union([from_bool, from_none], obj.get("continueOnAutoMode")) copilot_url = from_union([from_str, from_none], obj.get("copilotUrl")) custom_agents_local_only = from_union([from_bool, from_none], obj.get("customAgentsLocalOnly")) disabled_instruction_sources = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledInstructionSources")) disabled_skills = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledSkills")) enable_file_hooks = from_union([from_bool, from_none], obj.get("enableFileHooks")) enable_host_git_operations = from_union([from_bool, from_none], obj.get("enableHostGitOperations")) enable_on_demand_instruction_discovery = from_union([from_bool, from_none], obj.get("enableOnDemandInstructionDiscovery")) enable_reasoning_summaries = from_union([from_bool, from_none], obj.get("enableReasoningSummaries")) enable_script_safety = from_union([from_bool, from_none], obj.get("enableScriptSafety")) enable_session_store = from_union([from_bool, from_none], obj.get("enableSessionStore")) enable_skills = from_union([from_bool, from_none], obj.get("enableSkills")) enable_streaming = from_union([from_bool, from_none], obj.get("enableStreaming")) env_value_mode = from_union([MCPSetEnvValueModeDetails, from_none], obj.get("envValueMode")) events_log_directory = from_union([from_str, from_none], obj.get("eventsLogDirectory")) excluded_builtin_agents = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludedBuiltinAgents")) excluded_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludedTools")) feature_flags = from_union([lambda x: from_dict(from_bool, x), from_none], obj.get("featureFlags")) installed_plugins = from_union([lambda x: from_list(SessionInstalledPlugin.from_dict, x), from_none], obj.get("installedPlugins")) integration_id = from_union([from_str, from_none], obj.get("integrationId")) is_experimental_mode = from_union([from_bool, from_none], obj.get("isExperimentalMode")) log_interactive_shells = from_union([from_bool, from_none], obj.get("logInteractiveShells")) lsp_client_name = from_union([from_str, from_none], obj.get("lspClientName")) manage_schedule_enabled = from_union([from_bool, from_none], obj.get("manageScheduleEnabled")) max_inline_binary_bytes = from_union([from_int, from_none], obj.get("maxInlineBinaryBytes")) model = from_union([from_str, from_none], obj.get("model")) model_capabilities_overrides = from_union([ModelCapabilitiesOverride.from_dict, from_none], obj.get("modelCapabilitiesOverrides")) organization_custom_instructions = from_union([from_str, from_none], obj.get("organizationCustomInstructions")) provider = from_union([ProviderConfig.from_dict, from_none], obj.get("provider")) reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) reasoning_summary = from_union([ReasoningSummary, from_none], obj.get("reasoningSummary")) running_in_interactive_mode = from_union([from_bool, from_none], obj.get("runningInInteractiveMode")) sandbox_config = from_union([SandboxConfig.from_dict, from_none], obj.get("sandboxConfig")) session_capabilities = from_union([lambda x: from_list(SessionCapability, x), from_none], obj.get("sessionCapabilities")) session_limits = from_union([SessionLimitsConfig.from_dict, from_none], obj.get("sessionLimits")) shell_init_profile = from_union([from_str, from_none], obj.get("shellInitProfile")) shell_process_flags = from_union([lambda x: from_list(from_str, x), from_none], obj.get("shellProcessFlags")) skill_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories")) skip_custom_instructions = from_union([from_bool, from_none], obj.get("skipCustomInstructions")) skip_embedding_retrieval = from_union([from_bool, from_none], obj.get("skipEmbeddingRetrieval")) suppress_custom_agent_prompt = from_union([from_bool, from_none], obj.get("suppressCustomAgentPrompt")) tool_filter_precedence = from_union([OptionsUpdateToolFilterPrecedence, from_none], obj.get("toolFilterPrecedence")) trajectory_file = from_union([from_str, from_none], obj.get("trajectoryFile")) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) return SessionUpdateOptionsParams(additional_content_exclusion_policies, agent_context, allow_all_mcp_server_instructions, ask_user_disabled, available_tools, capi, client_name, coauthor_enabled, context_tier, continue_on_auto_mode, copilot_url, custom_agents_local_only, disabled_instruction_sources, disabled_skills, enable_file_hooks, enable_host_git_operations, enable_on_demand_instruction_discovery, enable_reasoning_summaries, enable_script_safety, enable_session_store, enable_skills, enable_streaming, env_value_mode, events_log_directory, excluded_builtin_agents, excluded_tools, feature_flags, installed_plugins, integration_id, is_experimental_mode, log_interactive_shells, lsp_client_name, manage_schedule_enabled, max_inline_binary_bytes, model, model_capabilities_overrides, organization_custom_instructions, provider, reasoning_effort, reasoning_summary, running_in_interactive_mode, sandbox_config, session_capabilities, session_limits, shell_init_profile, shell_process_flags, skill_directories, skip_custom_instructions, skip_embedding_retrieval, suppress_custom_agent_prompt, tool_filter_precedence, trajectory_file, working_directory) def to_dict(self) -> dict: result: dict = {} if self.additional_content_exclusion_policies is not None: result["additionalContentExclusionPolicies"] = from_union([lambda x: from_list(lambda x: to_class(OptionsUpdateAdditionalContentExclusionPolicy, x), x), from_none], self.additional_content_exclusion_policies) if self.agent_context is not None: result["agentContext"] = from_union([from_str, from_none], self.agent_context) if self.allow_all_mcp_server_instructions is not None: result["allowAllMcpServerInstructions"] = from_union([from_bool, from_none], self.allow_all_mcp_server_instructions) if self.ask_user_disabled is not None: result["askUserDisabled"] = from_union([from_bool, from_none], self.ask_user_disabled) if self.available_tools is not None: result["availableTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.available_tools) if self.capi is not None: result["capi"] = from_union([lambda x: to_class(CapiSessionOptions, x), from_none], self.capi) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.coauthor_enabled is not None: result["coauthorEnabled"] = from_union([from_bool, from_none], self.coauthor_enabled) if self.context_tier is not None: result["contextTier"] = from_union([lambda x: to_enum(OptionsUpdateContextTier, x), from_none], self.context_tier) if self.continue_on_auto_mode is not None: result["continueOnAutoMode"] = from_union([from_bool, from_none], self.continue_on_auto_mode) if self.copilot_url is not None: result["copilotUrl"] = from_union([from_str, from_none], self.copilot_url) if self.custom_agents_local_only is not None: result["customAgentsLocalOnly"] = from_union([from_bool, from_none], self.custom_agents_local_only) if self.disabled_instruction_sources is not None: result["disabledInstructionSources"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_instruction_sources) if self.disabled_skills is not None: result["disabledSkills"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_skills) if self.enable_file_hooks is not None: result["enableFileHooks"] = from_union([from_bool, from_none], self.enable_file_hooks) if self.enable_host_git_operations is not None: result["enableHostGitOperations"] = from_union([from_bool, from_none], self.enable_host_git_operations) if self.enable_on_demand_instruction_discovery is not None: result["enableOnDemandInstructionDiscovery"] = from_union([from_bool, from_none], self.enable_on_demand_instruction_discovery) if self.enable_reasoning_summaries is not None: result["enableReasoningSummaries"] = from_union([from_bool, from_none], self.enable_reasoning_summaries) if self.enable_script_safety is not None: result["enableScriptSafety"] = from_union([from_bool, from_none], self.enable_script_safety) if self.enable_session_store is not None: result["enableSessionStore"] = from_union([from_bool, from_none], self.enable_session_store) if self.enable_skills is not None: result["enableSkills"] = from_union([from_bool, from_none], self.enable_skills) if self.enable_streaming is not None: result["enableStreaming"] = from_union([from_bool, from_none], self.enable_streaming) if self.env_value_mode is not None: result["envValueMode"] = from_union([lambda x: to_enum(MCPSetEnvValueModeDetails, x), from_none], self.env_value_mode) if self.events_log_directory is not None: result["eventsLogDirectory"] = from_union([from_str, from_none], self.events_log_directory) if self.excluded_builtin_agents is not None: result["excludedBuiltinAgents"] = from_union([lambda x: from_list(from_str, x), from_none], self.excluded_builtin_agents) if self.excluded_tools is not None: result["excludedTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.excluded_tools) if self.feature_flags is not None: result["featureFlags"] = from_union([lambda x: from_dict(from_bool, x), from_none], self.feature_flags) if self.installed_plugins is not None: result["installedPlugins"] = from_union([lambda x: from_list(lambda x: to_class(SessionInstalledPlugin, x), x), from_none], self.installed_plugins) if self.integration_id is not None: result["integrationId"] = from_union([from_str, from_none], self.integration_id) if self.is_experimental_mode is not None: result["isExperimentalMode"] = from_union([from_bool, from_none], self.is_experimental_mode) if self.log_interactive_shells is not None: result["logInteractiveShells"] = from_union([from_bool, from_none], self.log_interactive_shells) if self.lsp_client_name is not None: result["lspClientName"] = from_union([from_str, from_none], self.lsp_client_name) if self.manage_schedule_enabled is not None: result["manageScheduleEnabled"] = from_union([from_bool, from_none], self.manage_schedule_enabled) if self.max_inline_binary_bytes is not None: result["maxInlineBinaryBytes"] = from_union([from_int, from_none], self.max_inline_binary_bytes) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.model_capabilities_overrides is not None: result["modelCapabilitiesOverrides"] = from_union([lambda x: to_class(ModelCapabilitiesOverride, x), from_none], self.model_capabilities_overrides) if self.organization_custom_instructions is not None: result["organizationCustomInstructions"] = from_union([from_str, from_none], self.organization_custom_instructions) if self.provider is not None: result["provider"] = from_union([lambda x: to_class(ProviderConfig, x), from_none], self.provider) if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) if self.reasoning_summary is not None: result["reasoningSummary"] = from_union([lambda x: to_enum(ReasoningSummary, x), from_none], self.reasoning_summary) if self.running_in_interactive_mode is not None: result["runningInInteractiveMode"] = from_union([from_bool, from_none], self.running_in_interactive_mode) if self.sandbox_config is not None: result["sandboxConfig"] = from_union([lambda x: to_class(SandboxConfig, x), from_none], self.sandbox_config) if self.session_capabilities is not None: result["sessionCapabilities"] = from_union([lambda x: from_list(lambda x: to_enum(SessionCapability, x), x), from_none], self.session_capabilities) if self.session_limits is not None: result["sessionLimits"] = from_union([lambda x: to_class(SessionLimitsConfig, x), from_none], self.session_limits) if self.shell_init_profile is not None: result["shellInitProfile"] = from_union([from_str, from_none], self.shell_init_profile) if self.shell_process_flags is not None: result["shellProcessFlags"] = from_union([lambda x: from_list(from_str, x), from_none], self.shell_process_flags) if self.skill_directories is not None: result["skillDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.skill_directories) if self.skip_custom_instructions is not None: result["skipCustomInstructions"] = from_union([from_bool, from_none], self.skip_custom_instructions) if self.skip_embedding_retrieval is not None: result["skipEmbeddingRetrieval"] = from_union([from_bool, from_none], self.skip_embedding_retrieval) if self.suppress_custom_agent_prompt is not None: result["suppressCustomAgentPrompt"] = from_union([from_bool, from_none], self.suppress_custom_agent_prompt) if self.tool_filter_precedence is not None: result["toolFilterPrecedence"] = from_union([lambda x: to_enum(OptionsUpdateToolFilterPrecedence, x), from_none], self.tool_filter_precedence) if self.trajectory_file is not None: result["trajectoryFile"] = from_union([from_str, from_none], self.trajectory_file) if self.working_directory is not None: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationRequest: """Prompt message and JSON schema describing the form fields to elicit from the user.""" message: str """Message describing what information is needed from the user""" requested_schema: UIElicitationSchema """JSON Schema describing the form fields to present to the user""" @staticmethod def from_dict(obj: Any) -> 'UIElicitationRequest': assert isinstance(obj, dict) message = from_str(obj.get("message")) requested_schema = UIElicitationSchema.from_dict(obj.get("requestedSchema")) return UIElicitationRequest(message, requested_schema) def to_dict(self) -> dict: result: dict = {} result["message"] = from_str(self.message) result["requestedSchema"] = to_class(UIElicitationSchema, self.requested_schema) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsOpenCreate: """Parameters for creating a new local session.""" kind: ClassVar[str] = "create" """Create a new local session.""" emit_start: bool | None = None """Whether to emit session.start during creation. Defaults to true.""" options: SessionOpenOptions | None = None """Session construction options.""" @staticmethod def from_dict(obj: Any) -> 'SessionsOpenCreate': assert isinstance(obj, dict) emit_start = from_union([from_bool, from_none], obj.get("emitStart")) options = from_union([SessionOpenOptions.from_dict, from_none], obj.get("options")) return SessionsOpenCreate(emit_start, options) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.emit_start is not None: result["emitStart"] = from_union([from_bool, from_none], self.emit_start) if self.options is not None: result["options"] = from_union([lambda x: to_class(SessionOpenOptions, x), from_none], self.options) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsOpenRemote: """Parameters for connecting to a live remote session.""" kind: ClassVar[str] = "remote" """Connect to a live remote session.""" remote_session_id: str """Remote session identifier to connect to.""" options: SessionOpenOptions | None = None """Session options for the connection.""" repository: RemoteSessionRepository | None = None """Repository context for the remote session.""" @staticmethod def from_dict(obj: Any) -> 'SessionsOpenRemote': assert isinstance(obj, dict) remote_session_id = from_str(obj.get("remoteSessionId")) options = from_union([SessionOpenOptions.from_dict, from_none], obj.get("options")) repository = from_union([RemoteSessionRepository.from_dict, from_none], obj.get("repository")) return SessionsOpenRemote(remote_session_id, options, repository) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["remoteSessionId"] = from_str(self.remote_session_id) if self.options is not None: result["options"] = from_union([lambda x: to_class(SessionOpenOptions, x), from_none], self.options) if self.repository is not None: result["repository"] = from_union([lambda x: to_class(RemoteSessionRepository, x), from_none], self.repository) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsOpenResume: """Parameters for resuming a specific local session.""" kind: ClassVar[str] = "resume" """Resume a specific local session by ID or prefix.""" session_id: str """Session ID or unique prefix to resume.""" options: SessionOpenOptions | None = None """Session resume options.""" resume: bool | None = None """Whether to emit session.resume after loading. Defaults to true.""" suppress_resume_workspace_metadata_writeback: bool | None = None """Suppress workspace.yaml metadata writeback when resuming from an incidental cwd.""" @staticmethod def from_dict(obj: Any) -> 'SessionsOpenResume': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) options = from_union([SessionOpenOptions.from_dict, from_none], obj.get("options")) resume = from_union([from_bool, from_none], obj.get("resume")) suppress_resume_workspace_metadata_writeback = from_union([from_bool, from_none], obj.get("suppressResumeWorkspaceMetadataWriteback")) return SessionsOpenResume(session_id, options, resume, suppress_resume_workspace_metadata_writeback) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["sessionId"] = from_str(self.session_id) if self.options is not None: result["options"] = from_union([lambda x: to_class(SessionOpenOptions, x), from_none], self.options) if self.resume is not None: result["resume"] = from_union([from_bool, from_none], self.resume) if self.suppress_resume_workspace_metadata_writeback is not None: result["suppressResumeWorkspaceMetadataWriteback"] = from_union([from_bool, from_none], self.suppress_resume_workspace_metadata_writeback) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsOpenResumeLast: """Parameters for resuming the most relevant local session.""" kind: ClassVar[str] = "resumeLast" """Resume the most relevant existing local session.""" context: SessionContext | None = None """Working-directory context used to choose the most relevant session.""" options: SessionOpenOptions | None = None """Session resume options.""" suppress_resume_workspace_metadata_writeback: bool | None = None """Suppress workspace.yaml metadata writeback when resuming from an incidental cwd.""" @staticmethod def from_dict(obj: Any) -> 'SessionsOpenResumeLast': assert isinstance(obj, dict) context = from_union([SessionContext.from_dict, from_none], obj.get("context")) options = from_union([SessionOpenOptions.from_dict, from_none], obj.get("options")) suppress_resume_workspace_metadata_writeback = from_union([from_bool, from_none], obj.get("suppressResumeWorkspaceMetadataWriteback")) return SessionsOpenResumeLast(context, options, suppress_resume_workspace_metadata_writeback) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.context is not None: result["context"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.context) if self.options is not None: result["options"] = from_union([lambda x: to_class(SessionOpenOptions, x), from_none], self.options) if self.suppress_resume_workspace_metadata_writeback is not None: result["suppressResumeWorkspaceMetadataWriteback"] = from_union([from_bool, from_none], self.suppress_resume_workspace_metadata_writeback) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentRegistryLiveTargetEntry: """Full registry entry for the spawned child. Lets the controller call `handleLiveTargetSelected(entry)` directly without re-reading the registry (avoids a TOCTOU window). """ copilot_version: str """Copilot CLI version that wrote the entry""" host: str """Bind host for the entry's JSON-RPC server""" kind: AgentRegistryLiveTargetEntryKind """Process kind tag for the registry entry""" last_seen_ms: int """Wall-clock milliseconds since the watcher last observed this entry (heartbeat freshness)""" pid: int """Operating-system pid of the process owning this entry""" port: int """TCP port the entry's JSON-RPC server is listening on""" schema_version: int """Registry entry schema version (1 = ui-server, 2 = managed-server)""" started_at: str """ISO 8601 timestamp captured at registration""" attention_kind: AgentRegistryLiveTargetEntryAttentionKind | None = None """Kind of attention required when status === "attention". Meaningful only when status === "attention". """ branch: str | None = None """Git branch of the session (when known)""" cwd: str | None = None """Working directory of the session (when known)""" last_terminal_event: AgentRegistryLiveTargetEntryLastTerminalEvent | None = None """How the most recent turn ended (clean vs aborted). Lets the renderer distinguish done from done_cancelled. """ model: str | None = None """Model identifier currently selected for the session""" session_id: str | None = None """Session ID of the foreground session for this entry""" session_name: str | None = None """Friendly session name (when set)""" status: AgentRegistryLiveTargetEntryStatus | None = None """Coarse lifecycle status of the foreground session""" status_revision: int | None = None """Monotonic per-publisher revision counter incremented on every status update. Lets watchers detect transient flips. """ # Internal: this field is an internal SDK API and is not part of the public surface. token: str | None = None """Connection token (null when the target is unauthenticated)""" @staticmethod def from_dict(obj: Any) -> 'AgentRegistryLiveTargetEntry': assert isinstance(obj, dict) copilot_version = from_str(obj.get("copilotVersion")) host = from_str(obj.get("host")) kind = AgentRegistryLiveTargetEntryKind(obj.get("kind")) last_seen_ms = from_int(obj.get("lastSeenMs")) pid = from_int(obj.get("pid")) port = from_int(obj.get("port")) schema_version = from_int(obj.get("schemaVersion")) started_at = from_str(obj.get("startedAt")) attention_kind = from_union([AgentRegistryLiveTargetEntryAttentionKind, from_none], obj.get("attentionKind")) branch = from_union([from_str, from_none], obj.get("branch")) cwd = from_union([from_str, from_none], obj.get("cwd")) last_terminal_event = from_union([AgentRegistryLiveTargetEntryLastTerminalEvent, from_none], obj.get("lastTerminalEvent")) model = from_union([from_str, from_none], obj.get("model")) session_id = from_union([from_str, from_none], obj.get("sessionId")) session_name = from_union([from_str, from_none], obj.get("sessionName")) status = from_union([AgentRegistryLiveTargetEntryStatus, from_none], obj.get("status")) status_revision = from_union([from_int, from_none], obj.get("statusRevision")) token = from_union([from_none, from_str], obj.get("token")) return AgentRegistryLiveTargetEntry(copilot_version, host, kind, last_seen_ms, pid, port, schema_version, started_at, attention_kind, branch, cwd, last_terminal_event, model, session_id, session_name, status, status_revision, token) def to_dict(self) -> dict: result: dict = {} result["copilotVersion"] = from_str(self.copilot_version) result["host"] = from_str(self.host) result["kind"] = to_enum(AgentRegistryLiveTargetEntryKind, self.kind) result["lastSeenMs"] = from_int(self.last_seen_ms) result["pid"] = from_int(self.pid) result["port"] = from_int(self.port) result["schemaVersion"] = from_int(self.schema_version) result["startedAt"] = from_str(self.started_at) if self.attention_kind is not None: result["attentionKind"] = from_union([lambda x: to_enum(AgentRegistryLiveTargetEntryAttentionKind, x), from_none], self.attention_kind) if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.last_terminal_event is not None: result["lastTerminalEvent"] = from_union([lambda x: to_enum(AgentRegistryLiveTargetEntryLastTerminalEvent, x), from_none], self.last_terminal_event) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.session_id is not None: result["sessionId"] = from_union([from_str, from_none], self.session_id) if self.session_name is not None: result["sessionName"] = from_union([from_str, from_none], self.session_name) if self.status is not None: result["status"] = from_union([lambda x: to_enum(AgentRegistryLiveTargetEntryStatus, x), from_none], self.status) if self.status_revision is not None: result["statusRevision"] = from_union([from_int, from_none], self.status_revision) if self.token is not None: result["token"] = from_union([from_none, from_str], self.token) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentRegistrySpawnRequest: """Inputs to spawn a managed-server child via the controller's spawn delegate.""" cwd: str """Working directory for the spawned child (must be an existing directory)""" agent_name: str | None = None """Custom or built-in agent name (e.g. 'explore'). When omitted, the child uses its own default. """ initial_prompt: str | None = None """Optional first user message. Forwarded to the caller (the CLI's spawn wrapper sends it post-attach via the standard LocalRpcSession.send path). """ model: str | None = None """Model identifier to apply to the new session""" name: str | None = None """Friendly session name. Must satisfy validateSessionName: non-empty, no leading/trailing whitespace, <=100 chars, no control chars, no double quotes. """ permission_mode: AgentRegistrySpawnPermissionMode | None = None """Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. """ @staticmethod def from_dict(obj: Any) -> 'AgentRegistrySpawnRequest': assert isinstance(obj, dict) cwd = from_str(obj.get("cwd")) agent_name = from_union([from_str, from_none], obj.get("agentName")) initial_prompt = from_union([from_str, from_none], obj.get("initialPrompt")) model = from_union([from_str, from_none], obj.get("model")) name = from_union([from_str, from_none], obj.get("name")) permission_mode = from_union([AgentRegistrySpawnPermissionMode, from_none], obj.get("permissionMode")) return AgentRegistrySpawnRequest(cwd, agent_name, initial_prompt, model, name, permission_mode) def to_dict(self) -> dict: result: dict = {} result["cwd"] = from_str(self.cwd) if self.agent_name is not None: result["agentName"] = from_union([from_str, from_none], self.agent_name) if self.initial_prompt is not None: result["initialPrompt"] = from_union([from_str, from_none], self.initial_prompt) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.permission_mode is not None: result["permissionMode"] = from_union([lambda x: to_enum(AgentRegistrySpawnPermissionMode, x), from_none], self.permission_mode) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentRegistrySpawnSpawned: """Managed-server child was spawned and registered successfully.""" entry: AgentRegistryLiveTargetEntry """Full registry entry for the spawned child. Lets the controller call `handleLiveTargetSelected(entry)` directly without re-reading the registry (avoids a TOCTOU window). """ kind: ClassVar[str] = "spawned" """Discriminator: managed-server child spawned successfully""" initial_prompt_error: str | None = None """If the delegate attempted to send the initial prompt and failed, the categorized error message. """ initial_prompt_sent: bool | None = None """Whether the delegate already sent the initial prompt. Always omitted in the current wiring: the controller sends the prompt post-attach via the standard LocalRpcSession.send path. """ log_capture: AgentRegistryLogCapture | None = None """Per-spawn log-capture outcome; populated from spawnLiveTarget.""" @staticmethod def from_dict(obj: Any) -> 'AgentRegistrySpawnSpawned': assert isinstance(obj, dict) entry = AgentRegistryLiveTargetEntry.from_dict(obj.get("entry")) initial_prompt_error = from_union([from_str, from_none], obj.get("initialPromptError")) initial_prompt_sent = from_union([from_bool, from_none], obj.get("initialPromptSent")) log_capture = from_union([AgentRegistryLogCapture.from_dict, from_none], obj.get("logCapture")) return AgentRegistrySpawnSpawned(entry, initial_prompt_error, initial_prompt_sent, log_capture) def to_dict(self) -> dict: result: dict = {} result["entry"] = to_class(AgentRegistryLiveTargetEntry, self.entry) result["kind"] = self.kind if self.initial_prompt_error is not None: result["initialPromptError"] = from_union([from_str, from_none], self.initial_prompt_error) if self.initial_prompt_sent is not None: result["initialPromptSent"] = from_union([from_bool, from_none], self.initial_prompt_sent) if self.log_capture is not None: result["logCapture"] = from_union([lambda x: to_class(AgentRegistryLogCapture, x), from_none], self.log_capture) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CurrentToolMetadata: """Lightweight metadata for a currently initialized session tool""" description: str """Tool description""" name: str """Model-facing tool name""" defer_loading: bool | None = None """Whether the tool is loaded on demand via tool search""" input_schema: dict[str, Any] | None = None """JSON Schema for tool input""" mcp_server_name: str | None = None """MCP server name for MCP-backed tools""" mcp_tool_name: str | None = None """Raw MCP tool name for MCP-backed tools""" namespaced_name: str | None = None """Optional MCP/config namespaced tool name""" @staticmethod def from_dict(obj: Any) -> 'CurrentToolMetadata': assert isinstance(obj, dict) description = from_str(obj.get("description")) name = from_str(obj.get("name")) defer_loading = from_union([from_bool, from_none], obj.get("deferLoading")) input_schema = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("input_schema")) mcp_server_name = from_union([from_str, from_none], obj.get("mcpServerName")) mcp_tool_name = from_union([from_str, from_none], obj.get("mcpToolName")) namespaced_name = from_union([from_str, from_none], obj.get("namespacedName")) return CurrentToolMetadata(description, name, defer_loading, input_schema, mcp_server_name, mcp_tool_name, namespaced_name) def to_dict(self) -> dict: result: dict = {} result["description"] = from_str(self.description) result["name"] = from_str(self.name) if self.defer_loading is not None: result["deferLoading"] = from_union([from_bool, from_none], self.defer_loading) if self.input_schema is not None: result["input_schema"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.input_schema) if self.mcp_server_name is not None: result["mcpServerName"] = from_union([from_str, from_none], self.mcp_server_name) if self.mcp_tool_name is not None: result["mcpToolName"] = from_union([from_str, from_none], self.mcp_tool_name) if self.namespaced_name is not None: result["namespacedName"] = from_union([from_str, from_none], self.namespaced_name) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class GitHubTelemetryEvent: """A single telemetry event in the runtime's native GitHub-shaped telemetry format, forwarded verbatim to opted-in hosts. The `restricted` flag on the enclosing GitHubTelemetryNotification distinguishes standard from restricted events; the payload shape is identical for both. The telemetry event, in the runtime's native GitHub-shaped telemetry format. """ kind: str """Event type/kind (e.g. get_completion_with_tools_turn, tool_call_executed).""" metrics: dict[str, float] """Numeric metrics as a map from key to value.""" properties: dict[str, str] """String-valued properties as a map from key to value.""" client: GitHubTelemetryClientInfo | None = None """Client environment metadata.""" copilot_tracking_id: str | None = None """Copilot tracking ID for user-level attribution.""" created_at: str | None = None """Timestamp when the event was created (ISO 8601 format).""" exp_assignment_context: str | None = None """Experiment assignment context.""" features: dict[str, str] | None = None """Feature flags enabled for this session, as a map from flag to value.""" model_call_id: str | None = None """Reference to the model call that produced this event.""" session_id: str | None = None """Session identifier the event belongs to.""" @staticmethod def from_dict(obj: Any) -> 'GitHubTelemetryEvent': assert isinstance(obj, dict) kind = from_str(obj.get("kind")) metrics = from_dict(from_float, obj.get("metrics")) properties = from_dict(from_str, obj.get("properties")) client = from_union([GitHubTelemetryClientInfo.from_dict, from_none], obj.get("client")) copilot_tracking_id = from_union([from_str, from_none], obj.get("copilot_tracking_id")) created_at = from_union([from_str, from_none], obj.get("created_at")) exp_assignment_context = from_union([from_str, from_none], obj.get("exp_assignment_context")) features = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("features")) model_call_id = from_union([from_str, from_none], obj.get("model_call_id")) session_id = from_union([from_str, from_none], obj.get("session_id")) return GitHubTelemetryEvent(kind, metrics, properties, client, copilot_tracking_id, created_at, exp_assignment_context, features, model_call_id, session_id) def to_dict(self) -> dict: result: dict = {} result["kind"] = from_str(self.kind) result["metrics"] = from_dict(to_float, self.metrics) result["properties"] = from_dict(from_str, self.properties) if self.client is not None: result["client"] = from_union([lambda x: to_class(GitHubTelemetryClientInfo, x), from_none], self.client) if self.copilot_tracking_id is not None: result["copilot_tracking_id"] = from_union([from_str, from_none], self.copilot_tracking_id) if self.created_at is not None: result["created_at"] = from_union([from_str, from_none], self.created_at) if self.exp_assignment_context is not None: result["exp_assignment_context"] = from_union([from_str, from_none], self.exp_assignment_context) if self.features is not None: result["features"] = from_union([lambda x: from_dict(from_str, x), from_none], self.features) if self.model_call_id is not None: result["model_call_id"] = from_union([from_str, from_none], self.model_call_id) if self.session_id is not None: result["session_id"] = from_union([from_str, from_none], self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class GitHubTelemetryNotification: """Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding for the session. """ event: GitHubTelemetryEvent """The telemetry event, in the runtime's native GitHub-shaped telemetry format.""" restricted: bool """Whether this is a restricted telemetry event (cli.restricted_telemetry). Hosts must route restricted events to first-party Microsoft stores only. """ session_id: str """Session the telemetry event belongs to.""" @staticmethod def from_dict(obj: Any) -> 'GitHubTelemetryNotification': assert isinstance(obj, dict) event = GitHubTelemetryEvent.from_dict(obj.get("event")) restricted = from_bool(obj.get("restricted")) session_id = from_str(obj.get("sessionId")) return GitHubTelemetryNotification(event, restricted, session_id) def to_dict(self) -> dict: result: dict = {} result["event"] = to_class(GitHubTelemetryEvent, self.event) result["restricted"] = from_bool(self.restricted) result["sessionId"] = from_str(self.session_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPExecuteSamplingParams: """Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference.""" request: dict[str, Any] """Raw MCP CreateMessageRequest params, as received in the `sampling.requested` event. Treated as opaque at the schema layer; the runtime converts the embedded MCP messages into the OpenAI chat-completion shape internally. """ request_id: str """Caller-provided unique identifier for this sampling execution. Use this same ID with cancelSamplingExecution to cancel the in-flight call. Must be unique within the session for the lifetime of the call. """ server_name: str """Name of the MCP server that initiated the sampling request""" mcp_request_id: Any = None """The original MCP JSON-RPC request ID (string or number). Used by the runtime to correlate the inference with the originating MCP request for telemetry; this is distinct from `requestId` (which is the schema-level cancellation handle). """ @staticmethod def from_dict(obj: Any) -> 'MCPExecuteSamplingParams': assert isinstance(obj, dict) mcp_request_id = obj.get("mcpRequestId") request = from_dict(lambda x: x, obj.get("request")) request_id = from_str(obj.get("requestId")) server_name = from_str(obj.get("serverName")) return MCPExecuteSamplingParams(mcp_request_id, request, request_id, server_name) def to_dict(self) -> dict: result: dict = {} result["mcpRequestId"] = self.mcp_request_id result["request"] = from_dict(lambda x: x, self.request) result["requestId"] = from_str(self.request_id) result["serverName"] = from_str(self.server_name) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class MCPOauthRespondRequest: """MCP OAuth request id and optional provider response.""" request_id: str """OAuth request identifier from mcp.oauth_required""" provider: Any = None """In-process OAuthClientProvider instance, or omitted to deny. Marked internal: cannot be serialized across the JSON-RPC boundary. """ @staticmethod def from_dict(obj: Any) -> 'MCPOauthRespondRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) provider = obj.get("provider") return MCPOauthRespondRequest(request_id, provider) def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) if self.provider is not None: result["provider"] = self.provider return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class MCPRegisterExternalClientRequest: """Registration parameters for an external MCP client.""" server_name: str """Logical server name for the external client""" client: Any = None """In-process MCP Client instance. Marked internal: cannot be serialized across the JSON-RPC boundary. """ config: Any = None """In-process server config (MCPServerConfig) paired with the in-process client/transport. Marked internal alongside its companions. """ transport: Any = None """In-process MCP Transport instance. Marked internal: cannot be serialized across the JSON-RPC boundary. """ @staticmethod def from_dict(obj: Any) -> 'MCPRegisterExternalClientRequest': assert isinstance(obj, dict) client = obj.get("client") config = obj.get("config") server_name = from_str(obj.get("serverName")) transport = obj.get("transport") return MCPRegisterExternalClientRequest(client, config, server_name, transport) def to_dict(self) -> dict: result: dict = {} result["client"] = self.client result["config"] = self.config result["serverName"] = from_str(self.server_name) result["transport"] = self.transport return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataContextInfoRequest: """Model identifier and token limits used to compute the context-info breakdown.""" output_token_limit: int """Maximum output tokens allowed by the target model. Pass 0 if unknown.""" prompt_token_limit: int """Maximum prompt tokens allowed by the target model. Pass 0 to use the runtime default.""" selected_model: str | None = None """Model identifier used for tokenization. Omit to use the session default. Used both for token counting and to compute display values. """ @staticmethod def from_dict(obj: Any) -> 'MetadataContextInfoRequest': assert isinstance(obj, dict) output_token_limit = from_int(obj.get("outputTokenLimit")) prompt_token_limit = from_int(obj.get("promptTokenLimit")) selected_model = from_union([from_str, from_none], obj.get("selectedModel")) return MetadataContextInfoRequest(output_token_limit, prompt_token_limit, selected_model) def to_dict(self) -> dict: result: dict = {} result["outputTokenLimit"] = from_int(self.output_token_limit) result["promptTokenLimit"] = from_int(self.prompt_token_limit) if self.selected_model is not None: result["selectedModel"] = from_union([from_str, from_none], self.selected_model) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecomputeContextTokensRequest: """Model identifier to use when re-tokenizing the session's existing messages.""" model_id: str """Model identifier used for tokenization. The runtime token-counts both chat-context and system-context messages against this model. """ @staticmethod def from_dict(obj: Any) -> 'MetadataRecomputeContextTokensRequest': assert isinstance(obj, dict) model_id = from_str(obj.get("modelId")) return MetadataRecomputeContextTokensRequest(model_id) def to_dict(self) -> dict: result: dict = {} result["modelId"] = from_str(self.model_id) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilities: """Model capabilities and limits""" limits: ModelCapabilitiesLimits | None = None """Token limits for prompts, outputs, and context window""" supports: ModelCapabilitiesSupports | None = None """Feature flags indicating what the model supports""" @staticmethod def from_dict(obj: Any) -> 'ModelCapabilities': assert isinstance(obj, dict) limits = from_union([ModelCapabilitiesLimits.from_dict, from_none], obj.get("limits")) supports = from_union([ModelCapabilitiesSupports.from_dict, from_none], obj.get("supports")) return ModelCapabilities(limits, supports) def to_dict(self) -> dict: result: dict = {} if self.limits is not None: result["limits"] = from_union([lambda x: to_class(ModelCapabilitiesLimits, x), from_none], self.limits) if self.supports is not None: result["supports"] = from_union([lambda x: to_class(ModelCapabilitiesSupports, x), from_none], self.supports) return result # Experimental: this type is part of an experimental API and may change or be removed. class ModelPickerCategory(Enum): """Model capability category for grouping in the model picker""" LIGHTWEIGHT = "lightweight" POWERFUL = "powerful" VERSATILE = "versatile" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Model: """Schema for the `Model` type.""" capabilities: ModelCapabilities """Model capabilities and limits""" id: str """Model identifier (e.g., "claude-sonnet-4.5")""" name: str """Display name""" billing: ModelBilling | None = None """Billing information""" default_reasoning_effort: str | None = None """Default reasoning effort level (only present if model supports reasoning effort)""" model_picker_category: ModelPickerCategory | None = None """Model capability category for grouping in the model picker""" model_picker_price_category: ModelPickerPriceCategory | None = None """Relative cost tier for token-based billing users""" policy: ModelPolicy | None = None """Policy state (if applicable)""" supported_reasoning_efforts: list[str] | None = None """Supported reasoning effort levels (only present if model supports reasoning effort)""" @staticmethod def from_dict(obj: Any) -> 'Model': assert isinstance(obj, dict) capabilities = ModelCapabilities.from_dict(obj.get("capabilities")) id = from_str(obj.get("id")) name = from_str(obj.get("name")) billing = from_union([ModelBilling.from_dict, from_none], obj.get("billing")) default_reasoning_effort = from_union([from_str, from_none], obj.get("defaultReasoningEffort")) model_picker_category = from_union([ModelPickerCategory, from_none], obj.get("modelPickerCategory")) model_picker_price_category = from_union([ModelPickerPriceCategory, from_none], obj.get("modelPickerPriceCategory")) policy = from_union([ModelPolicy.from_dict, from_none], obj.get("policy")) supported_reasoning_efforts = from_union([lambda x: from_list(from_str, x), from_none], obj.get("supportedReasoningEfforts")) return Model(capabilities, id, name, billing, default_reasoning_effort, model_picker_category, model_picker_price_category, policy, supported_reasoning_efforts) def to_dict(self) -> dict: result: dict = {} result["capabilities"] = to_class(ModelCapabilities, self.capabilities) result["id"] = from_str(self.id) result["name"] = from_str(self.name) if self.billing is not None: result["billing"] = from_union([lambda x: to_class(ModelBilling, x), from_none], self.billing) if self.default_reasoning_effort is not None: result["defaultReasoningEffort"] = from_union([from_str, from_none], self.default_reasoning_effort) if self.model_picker_category is not None: result["modelPickerCategory"] = from_union([lambda x: to_enum(ModelPickerCategory, x), from_none], self.model_picker_category) if self.model_picker_price_category is not None: result["modelPickerPriceCategory"] = from_union([lambda x: to_enum(ModelPickerPriceCategory, x), from_none], self.model_picker_price_category) if self.policy is not None: result["policy"] = from_union([lambda x: to_class(ModelPolicy, x), from_none], self.policy) if self.supported_reasoning_efforts is not None: result["supportedReasoningEfforts"] = from_union([lambda x: from_list(from_str, x), from_none], self.supported_reasoning_efforts) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelList: """List of Copilot models available to the resolved user, including capabilities and billing metadata. """ models: list[Model] """List of available models with full metadata""" @staticmethod def from_dict(obj: Any) -> 'ModelList': assert isinstance(obj, dict) models = from_list(Model.from_dict, obj.get("models")) return ModelList(models) def to_dict(self) -> dict: result: dict = {} result["models"] = from_list(lambda x: to_class(Model, x), self.models) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSwitchToRequest: """Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. """ model_id: str """Model selection id to switch to, as returned by `list`. A bare id (e.g. `claude-sonnet-4.6`) names a Copilot (CAPI) model; a provider-qualified id (`provider/id`, e.g. `acme/claude-sonnet`) targets a registry BYOK model. """ context_tier: ContextTier | None = None """Explicit context tier for the selected model. `"default"` / `"long_context"` apply the requested tier; omit this field to use normal model behavior with no explicit tier. """ model_capabilities: ModelCapabilitiesOverride | None = None """Override individual model capabilities resolved by the runtime""" reasoning_effort: str | None = None """Reasoning effort level to use for the model. "none" disables reasoning.""" reasoning_summary: ReasoningSummary | None = None """Reasoning summary mode to request for supported model clients""" @staticmethod def from_dict(obj: Any) -> 'ModelSwitchToRequest': assert isinstance(obj, dict) model_id = from_str(obj.get("modelId")) context_tier = from_union([ContextTier, from_none], obj.get("contextTier")) model_capabilities = from_union([ModelCapabilitiesOverride.from_dict, from_none], obj.get("modelCapabilities")) reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) reasoning_summary = from_union([ReasoningSummary, from_none], obj.get("reasoningSummary")) return ModelSwitchToRequest(model_id, context_tier, model_capabilities, reasoning_effort, reasoning_summary) def to_dict(self) -> dict: result: dict = {} result["modelId"] = from_str(self.model_id) if self.context_tier is not None: result["contextTier"] = from_union([lambda x: to_enum(ContextTier, x), from_none], self.context_tier) if self.model_capabilities is not None: result["modelCapabilities"] = from_union([lambda x: to_class(ModelCapabilitiesOverride, x), from_none], self.model_capabilities) if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) if self.reasoning_summary is not None: result["reasoningSummary"] = from_union([lambda x: to_enum(ReasoningSummary, x), from_none], self.reasoning_summary) return result # Experimental: this type is part of an experimental API and may change or be removed. class PermissionsSetAAllSource(Enum): """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" AUTOPILOT_CONFIRMATION = "autopilot_confirmation" CLI_FLAG = "cli_flag" RPC = "rpc" SLASH_COMMAND = "slash_command" # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetAllowAllRequest: """Whether to enable full allow-all permissions for the session.""" enabled: bool """Whether to enable full allow-all permissions""" source: PermissionsSetAAllSource | None = None """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsSetAllowAllRequest': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) source = from_union([PermissionsSetAAllSource, from_none], obj.get("source")) return PermissionsSetAllowAllRequest(enabled, source) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) if self.source is not None: result["source"] = from_union([lambda x: to_enum(PermissionsSetAAllSource, x), from_none], self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetApproveAllRequest: """Allow-all toggle for tool permission requests, with an optional telemetry source.""" enabled: bool """Whether to auto-approve all tool permission requests""" source: PermissionsSetAAllSource | None = None """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" @staticmethod def from_dict(obj: Any) -> 'PermissionsSetApproveAllRequest': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) source = from_union([PermissionsSetAAllSource, from_none], obj.get("source")) return PermissionsSetApproveAllRequest(enabled, source) def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) if self.source is not None: result["source"] = from_union([lambda x: to_enum(PermissionsSetAAllSource, x), from_none], self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ProviderGetEndpointRequest: """Optional model identifier to scope the endpoint snapshot to.""" model_id: str | None = None """Model identifier the caller intends to use against the returned endpoint. Used to pick the correct wire shape. Omit to use whichever model the session is currently using. """ @staticmethod def from_dict(obj: Any) -> 'ProviderGetEndpointRequest': assert isinstance(obj, dict) model_id = from_union([from_str, from_none], obj.get("modelId")) return ProviderGetEndpointRequest(model_id) def to_dict(self) -> dict: result: dict = {} if self.model_id is not None: result["modelId"] = from_union([from_str, from_none], self.model_id) return result # Experimental: this type is part of an experimental API and may change or be removed. # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _RegisterExtensionToolsResult: """Handle for releasing the extension tool registration.""" unsubscribe: Any """In-process unsubscribe function (CLI-only optimization). Marked internal: replaced by an explicit `extensions.unregister` RPC in the SDK migration. """ @staticmethod def from_dict(obj: Any) -> '_RegisterExtensionToolsResult': assert isinstance(obj, dict) unsubscribe = obj.get("unsubscribe") return _RegisterExtensionToolsResult(unsubscribe) def to_dict(self) -> dict: result: dict = {} result["unsubscribe"] = self.unsubscribe return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsOpenCloud: """Parameters for creating a new cloud session.""" kind: ClassVar[str] = "cloud" """Create a new cloud (coding-agent) session.""" # Internal: this field is an internal SDK API and is not part of the public surface. on_task_created: Any = None """In-process callback invoked when the cloud task is created (before connection). Marked internal because a function reference cannot cross the JSON-RPC boundary. Disappears in the SDK migration: the field is purely cosmetic (it flips a single CLI phase label from 'creating' to 'connecting') and the wire-clean version just drops the intermediate phase. """ options: SessionOpenOptions | None = None """Session options for cloud session creation.""" owner: str | None = None """Optional owner (user or organization login) to associate with the cloud session when no repository is provided. Ignored when `repository` is set (the repo's owner takes precedence). """ repository: RemoteSessionRepository | None = None """Repository for the cloud session.""" @staticmethod def from_dict(obj: Any) -> 'SessionsOpenCloud': assert isinstance(obj, dict) on_task_created = obj.get("onTaskCreated") options = from_union([SessionOpenOptions.from_dict, from_none], obj.get("options")) owner = from_union([from_str, from_none], obj.get("owner")) repository = from_union([RemoteSessionRepository.from_dict, from_none], obj.get("repository")) return SessionsOpenCloud(on_task_created, options, owner, repository) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind if self.on_task_created is not None: result["onTaskCreated"] = self.on_task_created if self.options is not None: result["options"] = from_union([lambda x: to_class(SessionOpenOptions, x), from_none], self.options) if self.owner is not None: result["owner"] = from_union([from_str, from_none], self.owner) if self.repository is not None: result["repository"] = from_union([lambda x: to_class(RemoteSessionRepository, x), from_none], self.repository) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsOpenHandoff: """Parameters for fetching a remote session and handing it off to a new local session.""" kind: ClassVar[str] = "handoff" """Fetch a remote session and hand it off to a new local session.""" metadata: RemoteSessionMetadataValue """Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). """ # Internal: this field is an internal SDK API and is not part of the public surface. on_progress: Any = None """In-process progress callback `(update) => void` invoked for each handoff step. Marked internal because a function reference cannot cross the JSON-RPC boundary. The host-side `handoffSession` is already declared as `AsyncGenerator`; the schema layer flattens it because it does not yet support streaming methods. The wire-clean replacement is to expose the AsyncGenerator directly (or use vscode-jsonrpc `$/progress` notifications) once the schema/transport layer supports it. """ options: SessionOpenOptions | None = None """Session construction options for the new local session.""" task_type: TaskType | None = None """Task type determines the handoff strategy (CCA fetches events; CLI prepares a transient session). """ @staticmethod def from_dict(obj: Any) -> 'SessionsOpenHandoff': assert isinstance(obj, dict) metadata = RemoteSessionMetadataValue.from_dict(obj.get("metadata")) on_progress = obj.get("onProgress") options = from_union([SessionOpenOptions.from_dict, from_none], obj.get("options")) task_type = from_union([TaskType, from_none], obj.get("taskType")) return SessionsOpenHandoff(metadata, on_progress, options, task_type) def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["metadata"] = to_class(RemoteSessionMetadataValue, self.metadata) if self.on_progress is not None: result["onProgress"] = self.on_progress if self.options is not None: result["options"] = from_union([lambda x: to_class(SessionOpenOptions, x), from_none], self.options) if self.task_type is not None: result["taskType"] = from_union([lambda x: to_enum(TaskType, x), from_none], self.task_type) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SubagentSettingsEntry: """Subagent model, reasoning effort, and context tier settings""" context_tier: SubagentSettingsEntryContextTier | None = None """Context tier override for matching subagents""" effort_level: str | None = None """Reasoning effort override for matching subagents""" model: str | None = None """Model override for matching subagents""" @staticmethod def from_dict(obj: Any) -> 'SubagentSettingsEntry': assert isinstance(obj, dict) context_tier = from_union([SubagentSettingsEntryContextTier, from_none], obj.get("contextTier")) effort_level = from_union([from_str, from_none], obj.get("effortLevel")) model = from_union([from_str, from_none], obj.get("model")) return SubagentSettingsEntry(context_tier, effort_level, model) def to_dict(self) -> dict: result: dict = {} if self.context_tier is not None: result["contextTier"] = from_union([lambda x: to_enum(SubagentSettingsEntryContextTier, x), from_none], self.context_tier) if self.effort_level is not None: result["effortLevel"] = from_union([from_str, from_none], self.effort_level) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SubagentSettings: """Configured per-agent subagent overrides""" agents: dict[str, SubagentSettingsEntry] | None = None """Per-agent settings keyed by subagent agent_type""" disabled_subagents: list[str] | None = None """Names of subagents the user has turned off; they cannot be dispatched""" max_concurrency: int | None = None """Maximum number of subagents that can run concurrently; applies to usage-based billing users only """ max_depth: int | None = None """Maximum subagent nesting depth; applies to usage-based billing users only""" @staticmethod def from_dict(obj: Any) -> 'SubagentSettings': assert isinstance(obj, dict) agents = from_union([lambda x: from_dict(SubagentSettingsEntry.from_dict, x), from_none], obj.get("agents")) disabled_subagents = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledSubagents")) max_concurrency = from_union([from_int, from_none], obj.get("maxConcurrency")) max_depth = from_union([from_int, from_none], obj.get("maxDepth")) return SubagentSettings(agents, disabled_subagents, max_concurrency, max_depth) def to_dict(self) -> dict: result: dict = {} if self.agents is not None: result["agents"] = from_union([lambda x: from_dict(lambda x: to_class(SubagentSettingsEntry, x), x), from_none], self.agents) if self.disabled_subagents is not None: result["disabledSubagents"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_subagents) if self.max_concurrency is not None: result["maxConcurrency"] = from_union([from_int, from_none], self.max_concurrency) if self.max_depth is not None: result["maxDepth"] = from_union([from_int, from_none], self.max_depth) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ToolsGetCurrentMetadataResult: """Current lightweight tool metadata snapshot for the session.""" tools: list[CurrentToolMetadata] | None = None """Current tool metadata, or null when tools have not been initialized yet""" @staticmethod def from_dict(obj: Any) -> 'ToolsGetCurrentMetadataResult': assert isinstance(obj, dict) tools = from_union([lambda x: from_list(CurrentToolMetadata.from_dict, x), from_none], obj.get("tools")) return ToolsGetCurrentMetadataResult(tools) def to_dict(self) -> dict: result: dict = {} result["tools"] = from_union([lambda x: from_list(lambda x: to_class(CurrentToolMetadata, x), x), from_none], self.tools) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIEphemeralQueryRequest: """Transient question to answer without adding it to conversation history.""" question: str """Question to answer from the current conversation context.""" # Internal: this field is an internal SDK API and is not part of the public surface. abort_signal: Any = None """In-process `AbortSignal` forwarded to the model client to cancel an in-flight request. Marked internal: excluded from the public SDK surface. Replaced by an explicit cancellation token + cancel RPC in the SDK migration. """ # Internal: this field is an internal SDK API and is not part of the public surface. on_chunk: Any = None """In-process streaming callback `(text) => void` invoked with each token as the model emits it. Marked internal: excluded from the public SDK surface. In a process-separated SDK this is replaced by a streaming RPC that yields chunks and a final answer. """ @staticmethod def from_dict(obj: Any) -> 'UIEphemeralQueryRequest': assert isinstance(obj, dict) question = from_str(obj.get("question")) abort_signal = obj.get("abortSignal") on_chunk = obj.get("onChunk") return UIEphemeralQueryRequest(question, abort_signal, on_chunk) def to_dict(self) -> dict: result: dict = {} result["question"] = from_str(self.question) if self.abort_signal is not None: result["abortSignal"] = self.abort_signal if self.on_chunk is not None: result["onChunk"] = self.on_chunk return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UpdateSubagentSettingsRequest: """Subagent settings to apply to the current session""" subagents: SubagentSettings | None = None """Subagent settings to apply, or null to clear the live session override""" @staticmethod def from_dict(obj: Any) -> 'UpdateSubagentSettingsRequest': assert isinstance(obj, dict) subagents = from_union([SubagentSettings.from_dict, from_none], obj.get("subagents")) return UpdateSubagentSettingsRequest(subagents) def to_dict(self) -> dict: result: dict = {} if self.subagents is not None: result["subagents"] = from_union([lambda x: to_class(SubagentSettings, x), from_none], self.subagents) return result @dataclass class RPC: abort_request: AbortRequest abort_result: AbortResult account_all_users: AccountAllUsers account_get_all_users_result: list[AccountAllUsers] account_get_current_auth_result: AccountGetCurrentAuthResult account_get_quota_request: AccountGetQuotaRequest account_get_quota_result: AccountGetQuotaResult account_login_request: AccountLoginRequest account_login_result: AccountLoginResult account_logout_request: AccountLogoutRequest account_logout_result: AccountLogoutResult account_quota_snapshot: AccountQuotaSnapshot adaptive_thinking_support: AdaptiveThinkingSupport agent_discovery_path: AgentDiscoveryPath agent_discovery_path_list: AgentDiscoveryPathList agent_discovery_path_scope: AgentDiscoveryPathScope agent_get_current_result: AgentGetCurrentResult agent_info: AgentInfo agent_info_source: AgentInfoSource agent_list: AgentList agent_registry_live_target_entry: AgentRegistryLiveTargetEntry agent_registry_live_target_entry_attention_kind: AgentRegistryLiveTargetEntryAttentionKind agent_registry_live_target_entry_kind: AgentRegistryLiveTargetEntryKind agent_registry_live_target_entry_last_terminal_event: AgentRegistryLiveTargetEntryLastTerminalEvent agent_registry_live_target_entry_status: AgentRegistryLiveTargetEntryStatus agent_registry_log_capture: AgentRegistryLogCapture agent_registry_log_capture_open_error_reason: AgentRegistryLogCaptureOpenErrorReason agent_registry_spawn_error: AgentRegistrySpawnError agent_registry_spawn_permission_mode: AgentRegistrySpawnPermissionMode agent_registry_spawn_registry_timeout: AgentRegistrySpawnRegistryTimeout agent_registry_spawn_request: AgentRegistrySpawnRequest agent_registry_spawn_result: AgentRegistrySpawnResult agent_registry_spawn_spawned: AgentRegistrySpawnSpawned agent_registry_spawn_validation_error: AgentRegistrySpawnValidationError agent_registry_spawn_validation_error_field: AgentRegistrySpawnValidationErrorField agent_registry_spawn_validation_error_reason: AgentRegistrySpawnValidationErrorReason agent_reload_result: AgentReloadResult agents_discover_request: AgentsDiscoverRequest agent_select_request: AgentSelectRequest agent_select_result: AgentSelectResult agents_get_discovery_paths_request: AgentsGetDiscoveryPathsRequest allow_all_permission_set_result: AllowAllPermissionSetResult allow_all_permission_state: AllowAllPermissionState api_key_auth_info: APIKeyAuthInfo auth_info: AuthInfo auth_info_type: AuthInfoType cancel_user_requested_shell_command_result: CancelUserRequestedShellCommandResult canvas_action: CanvasAction canvas_action_invoke_request: CanvasActionInvokeRequest canvas_action_invoke_result: Any canvas_close_request: CanvasCloseRequest canvas_host_context: CanvasHostContext canvas_host_context_capabilities: CanvasHostContextCapabilities canvas_json_schema: Any canvas_list: CanvasList canvas_list_open_result: CanvasListOpenResult canvas_open_request: CanvasOpenRequest canvas_provider_close_request: CanvasProviderCloseRequest canvas_provider_invoke_action_request: CanvasProviderInvokeActionRequest canvas_provider_open_request: CanvasProviderOpenRequest canvas_provider_open_result: CanvasProviderOpenResult canvas_session_context: CanvasSessionContext capi_session_options: CapiSessionOptions command_list: CommandList commands_handle_pending_command_request: CommandsHandlePendingCommandRequest commands_handle_pending_command_result: CommandsHandlePendingCommandResult commands_invoke_request: CommandsInvokeRequest commands_list_request: CommandsListRequest commands_respond_to_queued_command_request: CommandsRespondToQueuedCommandRequest commands_respond_to_queued_command_result: CommandsRespondToQueuedCommandResult completions_get_trigger_characters_result: CompletionsGetTriggerCharactersResult completions_request_request: CompletionsRequestRequest completions_request_result: CompletionsRequestResult configure_session_extensions_params: _ConfigureSessionExtensionsParams connected_remote_session_metadata: ConnectedRemoteSessionMetadata connected_remote_session_metadata_kind: ConnectedRemoteSessionMetadataKind connected_remote_session_metadata_repository: ConnectedRemoteSessionMetadataRepository connect_remote_session_params: ConnectRemoteSessionParams connect_request: _ConnectRequest connect_result: _ConnectResult content_filter_mode: ContentFilterMode copilot_api_token_auth_info: CopilotAPITokenAuthInfo copilot_user_response: CopilotUserResponse copilot_user_response_endpoints: CopilotUserResponseEndpoints copilot_user_response_quota_snapshots: dict[str, CopilotUserResponseQuotaSnapshots | None] copilot_user_response_quota_snapshots_chat: CopilotUserResponseQuotaSnapshotsChat copilot_user_response_quota_snapshots_completions: CopilotUserResponseQuotaSnapshotsCompletions copilot_user_response_quota_snapshots_premium_interactions: CopilotUserResponseQuotaSnapshotsPremiumInteractions current_model: CurrentModel current_tool_metadata: CurrentToolMetadata discovered_canvas: DiscoveredCanvas discovered_mcp_server: DiscoveredMCPServer discovered_mcp_server_type: DiscoveredMCPServerType enqueue_command_params: EnqueueCommandParams enqueue_command_result: EnqueueCommandResult env_auth_info: EnvAuthInfo event_log_read_request: EventLogReadRequest event_log_release_interest_result: EventLogReleaseInterestResult event_log_tail_result: EventLogTailResult event_log_types: list[str] | EventLogTypes events_agent_scope: EventsAgentScope events_cursor_status: EventsCursorStatus events_read_result: EventsReadResult execute_command_params: ExecuteCommandParams execute_command_result: ExecuteCommandResult extension: Extension extension_context_push_input: ExtensionContextPushInput extension_list: ExtensionList extensions_disable_request: ExtensionsDisableRequest extensions_enable_request: ExtensionsEnableRequest extension_source: ExtensionSource extension_status: ExtensionStatus external_tool_result: ExternalToolTextResultForLlm | str external_tool_text_result_for_llm: ExternalToolTextResultForLlm external_tool_text_result_for_llm_binary_results_for_llm: ExternalToolTextResultForLlmBinaryResultsForLlm external_tool_text_result_for_llm_binary_results_for_llm_type: ExternalToolTextResultForLlmBinaryResultsForLlmType external_tool_text_result_for_llm_content: ExternalToolTextResultForLlmContent external_tool_text_result_for_llm_content_audio: ExternalToolTextResultForLlmContentAudio external_tool_text_result_for_llm_content_image: ExternalToolTextResultForLlmContentImage external_tool_text_result_for_llm_content_resource: ExternalToolTextResultForLlmContentResource external_tool_text_result_for_llm_content_resource_details: ExternalToolTextResultForLlmContentResourceDetails external_tool_text_result_for_llm_content_resource_link: ExternalToolTextResultForLlmContentResourceLink external_tool_text_result_for_llm_content_resource_link_icon: ExternalToolTextResultForLlmContentResourceLinkIcon external_tool_text_result_for_llm_content_resource_link_icon_theme: Theme external_tool_text_result_for_llm_content_shell_exit: ExternalToolTextResultForLlmContentShellExit external_tool_text_result_for_llm_content_terminal: ExternalToolTextResultForLlmContentTerminal external_tool_text_result_for_llm_content_text: ExternalToolTextResultForLlmContentText filter_mapping: dict[str, ContentFilterMode] | ContentFilterMode fleet_start_request: FleetStartRequest fleet_start_result: FleetStartResult folder_trust_add_params: FolderTrustAddParams folder_trust_check_params: FolderTrustCheckParams folder_trust_check_result: FolderTrustCheckResult gh_cli_auth_info: GhCLIAuthInfo git_hub_telemetry_client_info: GitHubTelemetryClientInfo git_hub_telemetry_event: GitHubTelemetryEvent git_hub_telemetry_notification: GitHubTelemetryNotification handle_pending_tool_call_request: HandlePendingToolCallRequest handle_pending_tool_call_result: HandlePendingToolCallResult history_abort_manual_compaction_result: HistoryAbortManualCompactionResult history_cancel_background_compaction_result: HistoryCancelBackgroundCompactionResult history_compact_context_window: HistoryCompactContextWindow history_compact_request: HistoryCompactRequest history_compact_result: HistoryCompactResult history_summarize_for_handoff_result: HistorySummarizeForHandoffResult history_truncate_request: HistoryTruncateRequest history_truncate_result: HistoryTruncateResult hmac_auth_info: HMACAuthInfo installed_plugin: InstalledPlugin installed_plugin_info: InstalledPluginInfo installed_plugin_source: InstalledPluginSource | str installed_plugin_source_git_hub: InstalledPluginSourceGitHub installed_plugin_source_local: InstalledPluginSourceLocal installed_plugin_source_url: InstalledPluginSourceURL instruction_discovery_path: InstructionDiscoveryPath instruction_discovery_path_kind: InstructionDiscoveryPathKind instruction_discovery_path_list: InstructionDiscoveryPathList instruction_discovery_path_location: InstructionLocation instructions_discover_request: InstructionsDiscoverRequest instructions_get_discovery_paths_request: InstructionsGetDiscoveryPathsRequest instructions_get_sources_result: InstructionsGetSourcesResult instruction_source: InstructionSource instruction_source_location: InstructionLocation instruction_source_type: InstructionSourceType llm_inference_headers: dict[str, list[str]] llm_inference_http_request_chunk_request: LlmInferenceHTTPRequestChunkRequest llm_inference_http_request_chunk_result: LlmInferenceHTTPRequestChunkResult llm_inference_http_request_start_request: LlmInferenceHTTPRequestStartRequest llm_inference_http_request_start_result: LlmInferenceHTTPRequestStartResult llm_inference_http_request_start_transport: LlmInferenceHTTPRequestStartTransport llm_inference_http_response_chunk_error: LlmInferenceHTTPResponseChunkError llm_inference_http_response_chunk_request: LlmInferenceHTTPResponseChunkRequest llm_inference_http_response_chunk_result: LlmInferenceHTTPResponseChunkResult llm_inference_http_response_start_request: LlmInferenceHTTPResponseStartRequest llm_inference_http_response_start_result: LlmInferenceHTTPResponseStartResult llm_inference_set_provider_result: LlmInferenceSetProviderResult local_session_metadata_value: LocalSessionMetadataValue log_request: LogRequest log_result: LogResult lsp_initialize_request: LspInitializeRequest marketplace_add_result: MarketplaceAddResult marketplace_browse_result: MarketplaceBrowseResult marketplace_info: MarketplaceInfo marketplace_list_result: MarketplaceListResult marketplace_plugin_info: MarketplacePluginInfo marketplace_refresh_entry: MarketplaceRefreshEntry marketplace_refresh_result: MarketplaceRefreshResult marketplace_remove_result: MarketplaceRemoveResult mcp_allowed_server: MCPAllowedServer mcp_apps_call_tool_request: MCPAppsCallToolRequest mcp_apps_diagnose_capability: MCPAppsDiagnoseCapability mcp_apps_diagnose_request: MCPAppsDiagnoseRequest mcp_apps_diagnose_result: MCPAppsDiagnoseResult mcp_apps_diagnose_server: MCPAppsDiagnoseServer mcp_apps_host_context: MCPAppsHostContext mcp_apps_host_context_details: MCPAppsHostContextDetails mcp_apps_host_context_details_available_display_mode: MCPAppsDisplayMode mcp_apps_host_context_details_display_mode: MCPAppsDisplayMode mcp_apps_host_context_details_platform: MCPAppsHostContextDetailsPlatform mcp_apps_host_context_details_theme: Theme mcp_apps_list_tools_request: MCPAppsListToolsRequest mcp_apps_list_tools_result: MCPAppsListToolsResult mcp_apps_read_resource_request: MCPAppsReadResourceRequest mcp_apps_read_resource_result: MCPAppsReadResourceResult mcp_apps_resource_content: MCPAppsResourceContent mcp_apps_set_host_context_details: MCPAppsSetHostContextDetails mcp_apps_set_host_context_details_available_display_mode: MCPAppsDisplayMode mcp_apps_set_host_context_details_display_mode: MCPAppsDisplayMode mcp_apps_set_host_context_details_platform: MCPAppsHostContextDetailsPlatform mcp_apps_set_host_context_details_theme: Theme mcp_apps_set_host_context_request: MCPAppsSetHostContextRequest mcp_cancel_sampling_execution_params: MCPCancelSamplingExecutionParams mcp_cancel_sampling_execution_result: MCPCancelSamplingExecutionResult mcp_config_add_request: MCPConfigAddRequest mcp_config_disable_request: MCPConfigDisableRequest mcp_config_enable_request: MCPConfigEnableRequest mcp_config_list: MCPConfigList mcp_config_remove_request: MCPConfigRemoveRequest mcp_config_update_request: MCPConfigUpdateRequest mcp_configure_git_hub_request: MCPConfigureGitHubRequest mcp_configure_git_hub_result: MCPConfigureGitHubResult mcp_disable_request: MCPDisableRequest mcp_discover_request: MCPDiscoverRequest mcp_discover_result: MCPDiscoverResult mcp_enable_request: MCPEnableRequest mcp_execute_sampling_params: MCPExecuteSamplingParams mcp_execute_sampling_request: dict[str, Any] mcp_execute_sampling_result: dict[str, Any] mcp_filtered_server: MCPFilteredServer mcp_headers_handle_pending_headers_refresh_request: MCPHeadersHandlePendingHeadersRefreshRequest mcp_headers_handle_pending_headers_refresh_request_request: MCPHeadersHandlePendingHeadersRefreshRequestRequest mcp_headers_handle_pending_headers_refresh_request_result: MCPHeadersHandlePendingHeadersRefreshRequestResult mcp_host_state: MCPHostState mcp_is_server_running_request: MCPIsServerRunningRequest mcp_is_server_running_result: MCPIsServerRunningResult mcp_list_tools_request: MCPListToolsRequest mcp_list_tools_result: MCPListToolsResult mcp_oauth_handle_pending_request: MCPOauthHandlePendingRequest mcp_oauth_handle_pending_result: MCPOauthHandlePendingResult mcp_oauth_login_grant_type: MCPGrantType mcp_oauth_login_request: MCPOauthLoginRequest mcp_oauth_login_result: MCPOauthLoginResult mcp_oauth_pending_request_response: MCPOauthPendingRequestResponse mcp_oauth_respond_request: MCPOauthRespondRequest mcp_oauth_respond_result: MCPOauthRespondResult mcp_register_external_client_request: MCPRegisterExternalClientRequest mcp_reload_with_config_request: MCPReloadWithConfigRequest mcp_remove_git_hub_result: MCPRemoveGitHubResult mcp_restart_server_request: MCPRestartServerRequest mcp_sampling_execution_action: MCPSamplingExecutionAction mcp_sampling_execution_result: MCPSamplingExecutionResult mcp_server: MCPServer mcp_server_auth_config: bool | MCPServerAuthConfigRedirectPort mcp_server_auth_config_redirect_port: MCPServerAuthConfigRedirectPort mcp_server_config: MCPServerConfig mcp_server_config_defer_tools: MCPServerConfigDeferTools mcp_server_config_http: MCPServerConfigHTTP mcp_server_config_http_oauth_grant_type: MCPGrantType mcp_server_config_http_type: MCPServerConfigHTTPType mcp_server_config_stdio: MCPServerConfigStdio mcp_server_failure_info: MCPServerFailureInfo mcp_server_list: MCPServerList mcp_server_needs_auth_info: MCPServerNeedsAuthInfo mcp_set_env_value_mode_details: MCPSetEnvValueModeDetails mcp_set_env_value_mode_params: MCPSetEnvValueModeParams mcp_set_env_value_mode_result: MCPSetEnvValueModeResult mcp_start_server_request: MCPStartServerRequest mcp_start_servers_result: MCPStartServersResult mcp_stop_server_request: MCPStopServerRequest mcp_tools: MCPTools mcp_unregister_external_client_request: MCPUnregisterExternalClientRequest memory_configuration: MemoryConfiguration metadata_context_info_request: MetadataContextInfoRequest metadata_context_info_result: MetadataContextInfoResult metadata_is_processing_result: MetadataIsProcessingResult metadata_recompute_context_tokens_request: MetadataRecomputeContextTokensRequest metadata_recompute_context_tokens_result: MetadataRecomputeContextTokensResult metadata_record_context_change_request: MetadataRecordContextChangeRequest metadata_record_context_change_result: MetadataRecordContextChangeResult metadata_set_working_directory_request: MetadataSetWorkingDirectoryRequest metadata_set_working_directory_result: MetadataSetWorkingDirectoryResult metadata_snapshot_current_mode: MetadataSnapshotCurrentMode metadata_snapshot_remote_metadata: MetadataSnapshotRemoteMetadata metadata_snapshot_remote_metadata_repository: MetadataSnapshotRemoteMetadataRepository metadata_snapshot_remote_metadata_task_type: TaskType model: Model model_billing: ModelBilling model_billing_token_prices: ModelBillingTokenPrices model_billing_token_prices_long_context: ModelBillingTokenPricesLongContext model_capabilities: ModelCapabilities model_capabilities_limits: ModelCapabilitiesLimits model_capabilities_limits_vision: ModelCapabilitiesLimitsVision model_capabilities_override: ModelCapabilitiesOverride model_capabilities_override_limits: ModelCapabilitiesOverrideLimits model_capabilities_override_limits_vision: ModelCapabilitiesOverrideLimitsVision model_capabilities_override_supports: ModelCapabilitiesOverrideSupports model_capabilities_supports: ModelCapabilitiesSupports model_list: ModelList model_list_request: ModelListRequest model_picker_category: ModelPickerCategory model_picker_price_category: ModelPickerPriceCategory model_policy: ModelPolicy model_policy_state: ModelPolicyState model_set_reasoning_effort_request: ModelSetReasoningEffortRequest model_set_reasoning_effort_result: ModelSetReasoningEffortResult models_list_request: ModelsListRequest model_switch_to_request: ModelSwitchToRequest model_switch_to_result: ModelSwitchToResult mode_set_request: ModeSetRequest named_provider_config: NamedProviderConfig name_get_result: NameGetResult name_set_auto_request: NameSetAutoRequest name_set_auto_result: NameSetAutoResult name_set_request: NameSetRequest open_canvas_instance: OpenCanvasInstance options_update_additional_content_exclusion_policy: OptionsUpdateAdditionalContentExclusionPolicy options_update_additional_content_exclusion_policy_rule: OptionsUpdateAdditionalContentExclusionPolicyRule options_update_additional_content_exclusion_policy_rule_source: OptionsUpdateAdditionalContentExclusionPolicyRuleSource options_update_additional_content_exclusion_policy_scope: AdditionalContentExclusionPolicyScope options_update_context_tier: OptionsUpdateContextTier options_update_env_value_mode: MCPSetEnvValueModeDetails options_update_reasoning_summary: ReasoningSummary options_update_tool_filter_precedence: OptionsUpdateToolFilterPrecedence pending_permission_request: PendingPermissionRequest pending_permission_request_list: PendingPermissionRequestList permission_decision: PermissionDecision permission_decision_approved: PermissionDecisionApproved permission_decision_approved_for_location: PermissionDecisionApprovedForLocation permission_decision_approved_for_session: PermissionDecisionApprovedForSession permission_decision_approve_for_location: PermissionDecisionApproveForLocation permission_decision_approve_for_location_approval: PermissionDecisionApproveForLocationApproval permission_decision_approve_for_location_approval_commands: PermissionDecisionApproveForLocationApprovalCommands permission_decision_approve_for_location_approval_custom_tool: PermissionDecisionApproveForLocationApprovalCustomTool permission_decision_approve_for_location_approval_extension_management: PermissionDecisionApproveForLocationApprovalExtensionManagement permission_decision_approve_for_location_approval_extension_permission_access: PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess permission_decision_approve_for_location_approval_mcp: PermissionDecisionApproveForLocationApprovalMCP permission_decision_approve_for_location_approval_mcp_sampling: PermissionDecisionApproveForLocationApprovalMCPSampling permission_decision_approve_for_location_approval_memory: PermissionDecisionApproveForLocationApprovalMemory permission_decision_approve_for_location_approval_read: PermissionDecisionApproveForLocationApprovalRead permission_decision_approve_for_location_approval_write: PermissionDecisionApproveForLocationApprovalWrite permission_decision_approve_for_session: PermissionDecisionApproveForSession permission_decision_approve_for_session_approval: PermissionDecisionApproveForSessionApproval permission_decision_approve_for_session_approval_commands: PermissionDecisionApproveForSessionApprovalCommands permission_decision_approve_for_session_approval_custom_tool: PermissionDecisionApproveForSessionApprovalCustomTool permission_decision_approve_for_session_approval_extension_management: PermissionDecisionApproveForSessionApprovalExtensionManagement permission_decision_approve_for_session_approval_extension_permission_access: PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess permission_decision_approve_for_session_approval_mcp: PermissionDecisionApproveForSessionApprovalMCP permission_decision_approve_for_session_approval_mcp_sampling: PermissionDecisionApproveForSessionApprovalMCPSampling permission_decision_approve_for_session_approval_memory: PermissionDecisionApproveForSessionApprovalMemory permission_decision_approve_for_session_approval_read: PermissionDecisionApproveForSessionApprovalRead permission_decision_approve_for_session_approval_write: PermissionDecisionApproveForSessionApprovalWrite permission_decision_approve_once: PermissionDecisionApproveOnce permission_decision_approve_permanently: PermissionDecisionApprovePermanently permission_decision_cancelled: PermissionDecisionCancelled permission_decision_denied_by_content_exclusion_policy: PermissionDecisionDeniedByContentExclusionPolicy permission_decision_denied_by_permission_request_hook: PermissionDecisionDeniedByPermissionRequestHook permission_decision_denied_by_rules: PermissionDecisionDeniedByRules permission_decision_denied_interactively_by_user: PermissionDecisionDeniedInteractivelyByUser permission_decision_denied_no_approval_rule_and_could_not_request_from_user: PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser permission_decision_reject: PermissionDecisionReject permission_decision_request: PermissionDecisionRequest permission_decision_user_not_available: PermissionDecisionUserNotAvailable permission_location_add_tool_approval_params: PermissionLocationAddToolApprovalParams permission_location_apply_params: PermissionLocationApplyParams permission_location_apply_result: PermissionLocationApplyResult permission_location_resolve_params: PermissionLocationResolveParams permission_location_resolve_result: PermissionLocationResolveResult permission_location_type: PermissionLocationType permission_paths_add_params: PermissionPathsAddParams permission_paths_allowed_check_params: PermissionPathsAllowedCheckParams permission_paths_allowed_check_result: PermissionPathsAllowedCheckResult permission_paths_config: PermissionPathsConfig permission_paths_list: PermissionPathsList permission_paths_update_primary_params: PermissionPathsUpdatePrimaryParams permission_paths_workspace_check_params: PermissionPathsWorkspaceCheckParams permission_paths_workspace_check_result: PermissionPathsWorkspaceCheckResult permission_prompt_shown_notification: PermissionPromptShownNotification permission_request_result: PermissionRequestResult permission_rules_set: PermissionRulesSet permissions_configure_additional_content_exclusion_policy: PermissionsConfigureAdditionalContentExclusionPolicy permissions_configure_additional_content_exclusion_policy_rule: PermissionsConfigureAdditionalContentExclusionPolicyRule permissions_configure_additional_content_exclusion_policy_rule_source: PermissionsConfigureAdditionalContentExclusionPolicyRuleSource permissions_configure_additional_content_exclusion_policy_scope: AdditionalContentExclusionPolicyScope permissions_configure_params: PermissionsConfigureParams permissions_configure_result: PermissionsConfigureResult permissions_folder_trust_add_trusted_result: PermissionsFolderTrustAddTrustedResult permissions_get_allow_all_request: PermissionsGetAllowAllRequest permissions_locations_add_tool_approval_details: PermissionsLocationsAddToolApprovalDetails permissions_locations_add_tool_approval_details_commands: PermissionsLocationsAddToolApprovalDetailsCommands permissions_locations_add_tool_approval_details_custom_tool: PermissionsLocationsAddToolApprovalDetailsCustomTool permissions_locations_add_tool_approval_details_extension_management: PermissionsLocationsAddToolApprovalDetailsExtensionManagement permissions_locations_add_tool_approval_details_extension_permission_access: PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess permissions_locations_add_tool_approval_details_mcp: PermissionsLocationsAddToolApprovalDetailsMCP permissions_locations_add_tool_approval_details_mcp_sampling: PermissionsLocationsAddToolApprovalDetailsMCPSampling permissions_locations_add_tool_approval_details_memory: PermissionsLocationsAddToolApprovalDetailsMemory permissions_locations_add_tool_approval_details_read: PermissionsLocationsAddToolApprovalDetailsRead permissions_locations_add_tool_approval_details_write: PermissionsLocationsAddToolApprovalDetailsWrite permissions_locations_add_tool_approval_result: PermissionsLocationsAddToolApprovalResult permissions_modify_rules_params: PermissionsModifyRulesParams permissions_modify_rules_result: PermissionsModifyRulesResult permissions_modify_rules_scope: PermissionsModifyRulesScope permissions_notify_prompt_shown_result: PermissionsNotifyPromptShownResult permissions_paths_add_result: PermissionsPathsAddResult permissions_paths_list_request: PermissionsPathsListRequest permissions_paths_update_primary_result: PermissionsPathsUpdatePrimaryResult permissions_pending_requests_request: PermissionsPendingRequestsRequest permissions_reset_session_approvals_request: PermissionsResetSessionApprovalsRequest permissions_reset_session_approvals_result: PermissionsResetSessionApprovalsResult permissions_set_allow_all_request: PermissionsSetAllowAllRequest permissions_set_allow_all_source: PermissionsSetAAllSource permissions_set_approve_all_request: PermissionsSetApproveAllRequest permissions_set_approve_all_result: PermissionsSetApproveAllResult permissions_set_approve_all_source: PermissionsSetAAllSource permissions_set_required_request: PermissionsSetRequiredRequest permissions_set_required_result: PermissionsSetRequiredResult permissions_urls_set_unrestricted_mode_result: PermissionsUrlsSetUnrestrictedModeResult permission_urls_config: PermissionUrlsConfig permission_urls_set_unrestricted_mode_params: PermissionUrlsSetUnrestrictedModeParams ping_request: PingRequest ping_result: PingResult plan_read_result: PlanReadResult plan_read_sql_todos_result: PlanReadSQLTodosResult plan_read_sql_todos_with_dependencies_result: PlanReadSQLTodosWithDependenciesResult plan_sql_todo_dependency: PlanSQLTodoDependency plan_sql_todos_row: PlanSQLTodosRow plan_update_request: PlanUpdateRequest plugin: Plugin plugin_install_result: PluginInstallResult plugin_list: PluginList plugin_list_result: PluginListResult plugins_disable_request: PluginsDisableRequest plugins_enable_request: PluginsEnableRequest plugins_install_request: PluginsInstallRequest plugins_marketplaces_add_request: PluginsMarketplacesAddRequest plugins_marketplaces_browse_request: PluginsMarketplacesBrowseRequest plugins_marketplaces_refresh_request: PluginsMarketplacesRefreshRequest plugins_marketplaces_remove_request: PluginsMarketplacesRemoveRequest plugins_reload_request: PluginsReloadRequest plugins_uninstall_request: PluginsUninstallRequest plugins_update_request: PluginsUpdateRequest plugin_update_all_entry: PluginUpdateAllEntry plugin_update_all_result: PluginUpdateAllResult plugin_update_result: PluginUpdateResult poll_spawned_sessions_result: PollSpawnedSessionsResult provider_add_request: ProviderAddRequest provider_add_result: ProviderAddResult provider_config: ProviderConfig provider_config_azure: ProviderConfigAzure provider_config_transport: ProviderTransport provider_config_type: ProviderType provider_config_wire_api: ProviderWireAPI provider_endpoint: ProviderEndpoint provider_endpoint_transport: ProviderTransport provider_endpoint_type: ProviderType provider_endpoint_wire_api: ProviderWireAPI provider_get_endpoint_request: ProviderGetEndpointRequest provider_model_config: ProviderModelConfig provider_session_token: ProviderSessionToken provider_token_acquire_request: ProviderTokenAcquireRequest provider_token_acquire_result: ProviderTokenAcquireResult push_attachment: PushAttachment push_attachment_blob: PushAttachmentBlob push_attachment_directory: PushAttachmentDirectory push_attachment_file: PushAttachmentFile push_attachment_file_line_range: PushAttachmentFileLineRange push_attachment_git_hub_actions_job: PushAttachmentGitHubActionsJob push_attachment_git_hub_commit: PushAttachmentGitHubCommit push_attachment_git_hub_file: PushAttachmentGitHubFile push_attachment_git_hub_file_diff: PushAttachmentGitHubFileDiff push_attachment_git_hub_file_diff_side: PushAttachmentGitHubFileDiffSide push_attachment_git_hub_reference: PushAttachmentGitHubReference push_attachment_git_hub_reference_type: PushAttachmentGitHubReferenceTypeEnum push_attachment_git_hub_release: PushAttachmentGitHubRelease push_attachment_git_hub_repository: PushAttachmentGitHubRepository push_attachment_git_hub_snippet: PushAttachmentGitHubSnippet push_attachment_git_hub_tree_comparison: PushAttachmentGitHubTreeComparison push_attachment_git_hub_tree_comparison_side: PushAttachmentGitHubTreeComparisonSide push_attachment_git_hub_url: PushAttachmentGitHubURL push_attachment_selection: PushAttachmentSelection push_attachment_selection_details: PushAttachmentSelectionDetails push_attachment_selection_details_end: PushAttachmentSelectionDetailsEnd push_attachment_selection_details_start: PushAttachmentSelectionDetailsStart push_git_hub_repo_ref: PushGitHubRepoRef queued_command_handled: QueuedCommandHandled queued_command_not_handled: QueuedCommandNotHandled queued_command_result: QueuedCommandResult queue_pending_items: QueuePendingItems queue_pending_items_kind: QueuePendingItemsKind queue_pending_items_result: QueuePendingItemsResult queue_remove_most_recent_result: QueueRemoveMostRecentResult register_event_interest_params: RegisterEventInterestParams register_event_interest_result: RegisterEventInterestResult register_extension_tools_params: _RegisterExtensionToolsParams register_extension_tools_result: _RegisterExtensionToolsResult release_event_interest_params: ReleaseEventInterestParams remote_control_config: RemoteControlConfig remote_control_config_existing_mc_session: RemoteControlConfigExistingMcSession remote_control_status: RemoteControlStatus remote_control_status_active: RemoteControlStatusActive remote_control_status_connecting: RemoteControlStatusConnecting remote_control_status_error: RemoteControlStatusError remote_control_status_off: RemoteControlStatusOff remote_control_status_result: RemoteControlStatusResult remote_control_stop_result: RemoteControlStopResult remote_control_transfer_result: RemoteControlTransferResult remote_enable_request: RemoteEnableRequest remote_enable_result: RemoteEnableResult remote_notify_steerable_changed_request: RemoteNotifySteerableChangedRequest remote_notify_steerable_changed_result: RemoteNotifySteerableChangedResult remote_session_connection_result: RemoteSessionConnectionResult remote_session_metadata_repository: RemoteSessionMetadataRepository remote_session_metadata_task_type: TaskType remote_session_metadata_value: RemoteSessionMetadataValue remote_session_mode: RemoteSessionMode remote_session_repository: RemoteSessionRepository sandbox_config: SandboxConfig sandbox_config_user_policy: SandboxConfigUserPolicy sandbox_config_user_policy_experimental: SandboxConfigUserPolicyExperimental sandbox_config_user_policy_experimental_seatbelt: SandboxConfigUserPolicyExperimentalSeatbelt sandbox_config_user_policy_filesystem: SandboxConfigUserPolicyFilesystem sandbox_config_user_policy_network: SandboxConfigUserPolicyNetwork sandbox_config_user_policy_seatbelt: SandboxConfigUserPolicySeatbelt schedule_entry: ScheduleEntry schedule_list: ScheduleList schedule_stop_request: ScheduleStopRequest schedule_stop_result: ScheduleStopResult secrets_add_filter_values_request: SecretsAddFilterValuesRequest secrets_add_filter_values_result: SecretsAddFilterValuesResult send_agent_mode: SendAgentMode send_attachments_to_message_params: SendAttachmentsToMessageParams send_mode: SendMode send_request: SendRequest send_result: SendResult server_agent_list: ServerAgentList server_instruction_source_list: ServerInstructionSourceList server_skill: ServerSkill server_skill_list: ServerSkillList session_activity: SessionActivity session_auth_status: SessionAuthStatus session_bulk_delete_result: SessionBulkDeleteResult session_capability: SessionCapability session_completion_item: SessionCompletionItem session_context: SessionContext session_context_host_type: HostType session_enrich_metadata_result: SessionEnrichMetadataResult session_fs_append_file_request: SessionFSAppendFileRequest session_fs_error: SessionFSError session_fs_error_code: SessionFSErrorCode session_fs_exists_request: SessionFSExistsRequest session_fs_exists_result: SessionFSExistsResult session_fs_mkdir_request: SessionFSMkdirRequest session_fs_readdir_request: SessionFSReaddirRequest session_fs_readdir_result: SessionFSReaddirResult session_fs_readdir_with_types_entry: SessionFSReaddirWithTypesEntry session_fs_readdir_with_types_entry_type: InstructionDiscoveryPathKind session_fs_readdir_with_types_request: SessionFSReaddirWithTypesRequest session_fs_readdir_with_types_result: SessionFSReaddirWithTypesResult session_fs_read_file_request: SessionFSReadFileRequest session_fs_read_file_result: SessionFSReadFileResult session_fs_rename_request: SessionFSRenameRequest session_fs_rm_request: SessionFSRmRequest session_fs_set_provider_capabilities: SessionFSSetProviderCapabilities session_fs_set_provider_conventions: SessionFSSetProviderConventions session_fs_set_provider_request: SessionFSSetProviderRequest session_fs_set_provider_result: SessionFSSetProviderResult session_fs_sqlite_exists_request: SessionFSSqliteExistsRequest session_fs_sqlite_exists_result: SessionFSSqliteExistsResult session_fs_sqlite_query_request: SessionFSSqliteQueryRequest session_fs_sqlite_query_result: SessionFSSqliteQueryResult session_fs_sqlite_query_type: SessionFSSqliteQueryType session_fs_stat_request: SessionFSStatRequest session_fs_stat_result: SessionFSStatResult session_fs_write_file_request: SessionFSWriteFileRequest session_installed_plugin: SessionInstalledPlugin session_installed_plugin_source: SessionInstalledPluginSource | str session_installed_plugin_source_git_hub: SessionInstalledPluginSourceGitHub session_installed_plugin_source_local: SessionInstalledPluginSourceLocal session_installed_plugin_source_url: SessionInstalledPluginSourceURL session_list: SessionList session_list_entry: SessionListEntry session_list_filter: SessionListFilter session_load_deferred_repo_hooks_result: SessionLoadDeferredRepoHooksResult session_log_level: SessionLogLevel session_mcp_apps_call_tool_result: dict[str, Any] session_metadata_snapshot: SessionMetadataSnapshot session_mode: SessionMode session_model_list: SessionModelList session_open_options: SessionOpenOptions session_open_options_additional_content_exclusion_policy: SessionOpenOptionsAdditionalContentExclusionPolicy session_open_options_additional_content_exclusion_policy_rule: SessionOpenOptionsAdditionalContentExclusionPolicyRule session_open_options_additional_content_exclusion_policy_rule_source: SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource session_open_options_additional_content_exclusion_policy_scope: AdditionalContentExclusionPolicyScope session_open_options_env_value_mode: MCPSetEnvValueModeDetails session_open_options_reasoning_summary: ReasoningSummary session_open_params: SessionOpenParams session_open_result: SessionOpenResult session_prune_result: SessionPruneResult sessions_bulk_delete_request: SessionsBulkDeleteRequest sessions_check_in_use_request: SessionsCheckInUseRequest sessions_check_in_use_result: SessionsCheckInUseResult sessions_close_request: SessionsCloseRequest sessions_close_result: SessionsCloseResult sessions_enrich_metadata_request: SessionsEnrichMetadataRequest session_set_credentials_params: SessionSetCredentialsParams session_set_credentials_result: SessionSetCredentialsResult sessions_find_by_prefix_request: SessionsFindByPrefixRequest sessions_find_by_prefix_result: SessionsFindByPrefixResult sessions_find_by_task_id_request: SessionsFindByTaskIDRequest sessions_find_by_task_id_result: SessionsFindByTaskIDResult sessions_fork_request: SessionsForkRequest sessions_fork_result: SessionsForkResult sessions_get_board_entry_count_request: SessionsGetBoardEntryCountRequest sessions_get_board_entry_count_result: SessionsGetBoardEntryCountResult sessions_get_event_file_path_request: SessionsGetEventFilePathRequest sessions_get_event_file_path_result: SessionsGetEventFilePathResult sessions_get_last_for_context_request: SessionsGetLastForContextRequest sessions_get_last_for_context_result: SessionsGetLastForContextResult sessions_get_persisted_remote_steerable_request: SessionsGetPersistedRemoteSteerableRequest sessions_get_persisted_remote_steerable_result: SessionsGetPersistedRemoteSteerableResult session_sizes: SessionSizes sessions_list_request: SessionsListRequest sessions_load_deferred_repo_hooks_request: SessionsLoadDeferredRepoHooksRequest sessions_open_attach: SessionsOpenAttach sessions_open_cloud: SessionsOpenCloud sessions_open_create: SessionsOpenCreate sessions_open_handoff: SessionsOpenHandoff sessions_open_handoff_task_type: TaskType sessions_open_progress: SessionsOpenProgress sessions_open_progress_status: SessionsOpenProgressStatus sessions_open_progress_step: SessionsOpenProgressStep sessions_open_remote: SessionsOpenRemote sessions_open_resume: SessionsOpenResume sessions_open_resume_last: SessionsOpenResumeLast sessions_open_status: SessionsOpenStatus session_source: SessionSource sessions_poll_spawned_sessions_event: SessionsPollSpawnedSessionsEvent sessions_poll_spawned_sessions_request: SessionsPollSpawnedSessionsRequest sessions_prune_old_request: SessionsPruneOldRequest sessions_register_extension_tools_on_session_options: SessionsRegisterExtensionToolsOnSessionOptions sessions_release_lock_request: SessionsReleaseLockRequest sessions_release_lock_result: SessionsReleaseLockResult sessions_reload_plugin_hooks_request: SessionsReloadPluginHooksRequest sessions_reload_plugin_hooks_result: SessionsReloadPluginHooksResult sessions_save_request: SessionsSaveRequest sessions_save_result: SessionsSaveResult sessions_set_additional_plugins_request: SessionsSetAdditionalPluginsRequest sessions_set_additional_plugins_result: SessionsSetAdditionalPluginsResult sessions_set_remote_control_steering_request: SessionsSetRemoteControlSteeringRequest sessions_start_remote_control_request: SessionsStartRemoteControlRequest sessions_stop_remote_control_request: SessionsStopRemoteControlRequest sessions_transfer_remote_control_request: SessionsTransferRemoteControlRequest session_telemetry_engagement: SessionTelemetryEngagement session_update_options_params: SessionUpdateOptionsParams session_update_options_result: SessionUpdateOptionsResult session_visibility_status: SessionVisibilityStatus session_working_directory_context: SessionWorkingDirectoryContext session_working_directory_context_host_type: HostType shell_cancel_user_requested_request: ShellCancelUserRequestedRequest shell_exec_request: ShellExecRequest shell_exec_result: ShellExecResult shell_execute_user_requested_request: ShellExecuteUserRequestedRequest shell_kill_request: ShellKillRequest shell_kill_result: ShellKillResult shell_kill_signal: ShellKillSignal shutdown_request: ShutdownRequest skill: Skill skill_discovery_path: SkillDiscoveryPath skill_discovery_path_list: SkillDiscoveryPathList skill_discovery_scope: SkillDiscoveryScope skill_list: SkillList skills_config_set_disabled_skills_request: SkillsConfigSetDisabledSkillsRequest skills_disable_request: SkillsDisableRequest skills_discover_request: SkillsDiscoverRequest skills_enable_request: SkillsEnableRequest skills_get_discovery_paths_request: SkillsGetDiscoveryPathsRequest skills_get_invoked_result: SkillsGetInvokedResult skills_invoked_skill: SkillsInvokedSkill skills_load_diagnostics: SkillsLoadDiagnostics slash_command_agent_prompt_result: SlashCommandAgentPromptResult slash_command_completed_result: SlashCommandCompletedResult slash_command_info: SlashCommandInfo slash_command_input: SlashCommandInput slash_command_input_completion: SlashCommandInputCompletion slash_command_invocation_result: SlashCommandInvocationResult slash_command_kind: SlashCommandKind slash_command_select_subcommand_option: SlashCommandSelectSubcommandOption slash_command_select_subcommand_result: SlashCommandSelectSubcommandResult slash_command_text_result: SlashCommandTextResult subagent_settings_entry: SubagentSettingsEntry subagent_settings_entry_context_tier: SubagentSettingsEntryContextTier task_agent_info: TaskAgentInfo task_agent_progress: TaskAgentProgress task_execution_mode: TaskExecutionMode task_info: TaskInfo task_list: TaskList task_progress_line: TaskProgressLine tasks_cancel_request: TasksCancelRequest tasks_cancel_result: TasksCancelResult tasks_get_current_promotable_result: TasksGetCurrentPromotableResult tasks_get_progress_request: TasksGetProgressRequest tasks_get_progress_result: TasksGetProgressResult task_shell_info: TaskShellInfo task_shell_info_attachment_mode: TaskShellInfoAttachmentMode task_shell_progress: TaskShellProgress tasks_promote_current_to_background_result: TasksPromoteCurrentToBackgroundResult tasks_promote_to_background_request: TasksPromoteToBackgroundRequest tasks_promote_to_background_result: TasksPromoteToBackgroundResult tasks_refresh_result: TasksRefreshResult tasks_remove_request: TasksRemoveRequest tasks_remove_result: TasksRemoveResult tasks_send_message_request: TasksSendMessageRequest tasks_send_message_result: TasksSendMessageResult tasks_start_agent_request: TasksStartAgentRequest tasks_start_agent_result: TasksStartAgentResult task_status: TaskStatus tasks_wait_for_pending_result: TasksWaitForPendingResult telemetry_set_feature_overrides_request: TelemetrySetFeatureOverridesRequest token_auth_info: TokenAuthInfo tool: Tool tool_list: ToolList tools_get_current_metadata_result: ToolsGetCurrentMetadataResult tools_initialize_and_validate_result: ToolsInitializeAndValidateResult tools_list_request: ToolsListRequest tools_update_subagent_settings_result: ToolsUpdateSubagentSettingsResult ui_auto_mode_switch_response: UIAutoModeSwitchResponse ui_elicitation_array_any_of_field: UIElicitationArrayAnyOfField ui_elicitation_array_any_of_field_items: UIElicitationArrayAnyOfFieldItems ui_elicitation_array_any_of_field_items_any_of: UIElicitationArrayAnyOfFieldItemsAnyOf ui_elicitation_array_enum_field: UIElicitationArrayEnumField ui_elicitation_array_enum_field_items: UIElicitationArrayEnumFieldItems ui_elicitation_field_value: float | bool | list[str] | str ui_elicitation_request: UIElicitationRequest ui_elicitation_response: UIElicitationResponse ui_elicitation_response_action: UIElicitationResponseAction ui_elicitation_response_content: dict[str, float | bool | list[str] | str] ui_elicitation_result: UIElicitationResult ui_elicitation_schema: UIElicitationSchema ui_elicitation_schema_property: UIElicitationSchemaProperty ui_elicitation_schema_property_boolean: UIElicitationSchemaPropertyBoolean ui_elicitation_schema_property_number: UIElicitationSchemaPropertyNumber ui_elicitation_schema_property_number_type: UIElicitationSchemaPropertyNumberType ui_elicitation_schema_property_string: UIElicitationSchemaPropertyString ui_elicitation_schema_property_string_format: UIElicitationSchemaPropertyStringFormat ui_elicitation_string_enum_field: UIElicitationStringEnumField ui_elicitation_string_one_of_field: UIElicitationStringOneOfField ui_elicitation_string_one_of_field_one_of: UIElicitationStringOneOfFieldOneOf ui_ephemeral_query_request: UIEphemeralQueryRequest ui_ephemeral_query_result: UIEphemeralQueryResult ui_exit_plan_mode_action: UIExitPlanModeAction ui_exit_plan_mode_response: UIExitPlanModeResponse ui_handle_pending_auto_mode_switch_request: UIHandlePendingAutoModeSwitchRequest ui_handle_pending_elicitation_request: UIHandlePendingElicitationRequest ui_handle_pending_exit_plan_mode_request: UIHandlePendingExitPlanModeRequest ui_handle_pending_result: UIHandlePendingResult ui_handle_pending_sampling_request: UIHandlePendingSamplingRequest ui_handle_pending_sampling_response: dict[str, Any] ui_handle_pending_session_limits_exhausted_request: UIHandlePendingSessionLimitsExhaustedRequest ui_handle_pending_user_input_request: UIHandlePendingUserInputRequest ui_register_direct_auto_mode_switch_handler_result: UIRegisterDirectAutoModeSwitchHandlerResult ui_session_limits_exhausted_response: UISessionLimitsExhaustedResponse ui_session_limits_exhausted_response_action: UISessionLimitsExhaustedResponseAction ui_unregister_direct_auto_mode_switch_handler_request: UIUnregisterDirectAutoModeSwitchHandlerRequest ui_unregister_direct_auto_mode_switch_handler_result: UIUnregisterDirectAutoModeSwitchHandlerResult ui_user_input_response: UIUserInputResponse update_subagent_settings_request: UpdateSubagentSettingsRequest usage_get_metrics_result: UsageGetMetricsResult usage_metrics_code_changes: UsageMetricsCodeChanges usage_metrics_model_metric: UsageMetricsModelMetric usage_metrics_model_metric_requests: UsageMetricsModelMetricRequests usage_metrics_model_metric_token_detail: UsageMetricsModelMetricTokenDetail usage_metrics_model_metric_usage: UsageMetricsModelMetricUsage usage_metrics_token_detail: UsageMetricsTokenDetail user_auth_info: UserAuthInfo user_requested_shell_command_result: UserRequestedShellCommandResult user_setting_metadata: UserSettingMetadata user_settings_get_result: UserSettingsGetResult user_settings_set_request: UserSettingsSetRequest user_settings_set_result: UserSettingsSetResult visibility_get_result: VisibilityGetResult visibility_set_request: VisibilitySetRequest visibility_set_result: VisibilitySetResult workspace_diff_file_change: WorkspaceDiffFileChange workspace_diff_file_change_type: WorkspaceDiffFileChangeType workspace_diff_mode: WorkspaceDiffMode workspace_diff_result: WorkspaceDiffResult workspaces_checkpoints: WorkspacesCheckpoints workspaces_create_file_request: WorkspacesCreateFileRequest workspaces_diff_request: WorkspacesDiffRequest workspaces_get_workspace_result: WorkspacesGetWorkspaceResult workspaces_list_checkpoints_result: WorkspacesListCheckpointsResult workspaces_list_files_result: WorkspacesListFilesResult workspaces_read_checkpoint_request: WorkspacesReadCheckpointRequest workspaces_read_checkpoint_result: WorkspacesReadCheckpointResult workspaces_read_file_request: WorkspacesReadFileRequest workspaces_read_file_result: WorkspacesReadFileResult workspaces_save_large_paste_request: WorkspacesSaveLargePasteRequest workspaces_save_large_paste_result: WorkspacesSaveLargePasteResult workspace_summary_host_type: HostType workspaces_workspace_details_host_type: HostType session_context_info: SessionContextInfo | None = None subagent_settings: SubagentSettings | None = None task_progress: TaskProgress | None = None workspace_summary: WorkspaceSummary | None = None @staticmethod def from_dict(obj: Any) -> 'RPC': assert isinstance(obj, dict) abort_request = AbortRequest.from_dict(obj.get("AbortRequest")) abort_result = AbortResult.from_dict(obj.get("AbortResult")) account_all_users = AccountAllUsers.from_dict(obj.get("AccountAllUsers")) account_get_all_users_result = from_list(AccountAllUsers.from_dict, obj.get("AccountGetAllUsersResult")) account_get_current_auth_result = AccountGetCurrentAuthResult.from_dict(obj.get("AccountGetCurrentAuthResult")) account_get_quota_request = AccountGetQuotaRequest.from_dict(obj.get("AccountGetQuotaRequest")) account_get_quota_result = AccountGetQuotaResult.from_dict(obj.get("AccountGetQuotaResult")) account_login_request = AccountLoginRequest.from_dict(obj.get("AccountLoginRequest")) account_login_result = AccountLoginResult.from_dict(obj.get("AccountLoginResult")) account_logout_request = AccountLogoutRequest.from_dict(obj.get("AccountLogoutRequest")) account_logout_result = AccountLogoutResult.from_dict(obj.get("AccountLogoutResult")) account_quota_snapshot = AccountQuotaSnapshot.from_dict(obj.get("AccountQuotaSnapshot")) adaptive_thinking_support = AdaptiveThinkingSupport(obj.get("AdaptiveThinkingSupport")) agent_discovery_path = AgentDiscoveryPath.from_dict(obj.get("AgentDiscoveryPath")) agent_discovery_path_list = AgentDiscoveryPathList.from_dict(obj.get("AgentDiscoveryPathList")) agent_discovery_path_scope = AgentDiscoveryPathScope(obj.get("AgentDiscoveryPathScope")) agent_get_current_result = AgentGetCurrentResult.from_dict(obj.get("AgentGetCurrentResult")) agent_info = AgentInfo.from_dict(obj.get("AgentInfo")) agent_info_source = AgentInfoSource(obj.get("AgentInfoSource")) agent_list = AgentList.from_dict(obj.get("AgentList")) agent_registry_live_target_entry = AgentRegistryLiveTargetEntry.from_dict(obj.get("AgentRegistryLiveTargetEntry")) agent_registry_live_target_entry_attention_kind = AgentRegistryLiveTargetEntryAttentionKind(obj.get("AgentRegistryLiveTargetEntryAttentionKind")) agent_registry_live_target_entry_kind = AgentRegistryLiveTargetEntryKind(obj.get("AgentRegistryLiveTargetEntryKind")) agent_registry_live_target_entry_last_terminal_event = AgentRegistryLiveTargetEntryLastTerminalEvent(obj.get("AgentRegistryLiveTargetEntryLastTerminalEvent")) agent_registry_live_target_entry_status = AgentRegistryLiveTargetEntryStatus(obj.get("AgentRegistryLiveTargetEntryStatus")) agent_registry_log_capture = AgentRegistryLogCapture.from_dict(obj.get("AgentRegistryLogCapture")) agent_registry_log_capture_open_error_reason = AgentRegistryLogCaptureOpenErrorReason(obj.get("AgentRegistryLogCaptureOpenErrorReason")) agent_registry_spawn_error = AgentRegistrySpawnError.from_dict(obj.get("AgentRegistrySpawnError")) agent_registry_spawn_permission_mode = AgentRegistrySpawnPermissionMode(obj.get("AgentRegistrySpawnPermissionMode")) agent_registry_spawn_registry_timeout = AgentRegistrySpawnRegistryTimeout.from_dict(obj.get("AgentRegistrySpawnRegistryTimeout")) agent_registry_spawn_request = AgentRegistrySpawnRequest.from_dict(obj.get("AgentRegistrySpawnRequest")) agent_registry_spawn_result = _load_AgentRegistrySpawnResult(obj.get("AgentRegistrySpawnResult")) agent_registry_spawn_spawned = AgentRegistrySpawnSpawned.from_dict(obj.get("AgentRegistrySpawnSpawned")) agent_registry_spawn_validation_error = AgentRegistrySpawnValidationError.from_dict(obj.get("AgentRegistrySpawnValidationError")) agent_registry_spawn_validation_error_field = AgentRegistrySpawnValidationErrorField(obj.get("AgentRegistrySpawnValidationErrorField")) agent_registry_spawn_validation_error_reason = AgentRegistrySpawnValidationErrorReason(obj.get("AgentRegistrySpawnValidationErrorReason")) agent_reload_result = AgentReloadResult.from_dict(obj.get("AgentReloadResult")) agents_discover_request = AgentsDiscoverRequest.from_dict(obj.get("AgentsDiscoverRequest")) agent_select_request = AgentSelectRequest.from_dict(obj.get("AgentSelectRequest")) agent_select_result = AgentSelectResult.from_dict(obj.get("AgentSelectResult")) agents_get_discovery_paths_request = AgentsGetDiscoveryPathsRequest.from_dict(obj.get("AgentsGetDiscoveryPathsRequest")) allow_all_permission_set_result = AllowAllPermissionSetResult.from_dict(obj.get("AllowAllPermissionSetResult")) allow_all_permission_state = AllowAllPermissionState.from_dict(obj.get("AllowAllPermissionState")) api_key_auth_info = APIKeyAuthInfo.from_dict(obj.get("ApiKeyAuthInfo")) auth_info = _load_AuthInfo(obj.get("AuthInfo")) auth_info_type = AuthInfoType(obj.get("AuthInfoType")) cancel_user_requested_shell_command_result = CancelUserRequestedShellCommandResult.from_dict(obj.get("CancelUserRequestedShellCommandResult")) canvas_action = CanvasAction.from_dict(obj.get("CanvasAction")) canvas_action_invoke_request = CanvasActionInvokeRequest.from_dict(obj.get("CanvasActionInvokeRequest")) canvas_action_invoke_result = obj.get("CanvasActionInvokeResult") canvas_close_request = CanvasCloseRequest.from_dict(obj.get("CanvasCloseRequest")) canvas_host_context = CanvasHostContext.from_dict(obj.get("CanvasHostContext")) canvas_host_context_capabilities = CanvasHostContextCapabilities.from_dict(obj.get("CanvasHostContextCapabilities")) canvas_json_schema = obj.get("CanvasJsonSchema") canvas_list = CanvasList.from_dict(obj.get("CanvasList")) canvas_list_open_result = CanvasListOpenResult.from_dict(obj.get("CanvasListOpenResult")) canvas_open_request = CanvasOpenRequest.from_dict(obj.get("CanvasOpenRequest")) canvas_provider_close_request = CanvasProviderCloseRequest.from_dict(obj.get("CanvasProviderCloseRequest")) canvas_provider_invoke_action_request = CanvasProviderInvokeActionRequest.from_dict(obj.get("CanvasProviderInvokeActionRequest")) canvas_provider_open_request = CanvasProviderOpenRequest.from_dict(obj.get("CanvasProviderOpenRequest")) canvas_provider_open_result = CanvasProviderOpenResult.from_dict(obj.get("CanvasProviderOpenResult")) canvas_session_context = CanvasSessionContext.from_dict(obj.get("CanvasSessionContext")) capi_session_options = CapiSessionOptions.from_dict(obj.get("CapiSessionOptions")) command_list = CommandList.from_dict(obj.get("CommandList")) commands_handle_pending_command_request = CommandsHandlePendingCommandRequest.from_dict(obj.get("CommandsHandlePendingCommandRequest")) commands_handle_pending_command_result = CommandsHandlePendingCommandResult.from_dict(obj.get("CommandsHandlePendingCommandResult")) commands_invoke_request = CommandsInvokeRequest.from_dict(obj.get("CommandsInvokeRequest")) commands_list_request = CommandsListRequest.from_dict(obj.get("CommandsListRequest")) commands_respond_to_queued_command_request = CommandsRespondToQueuedCommandRequest.from_dict(obj.get("CommandsRespondToQueuedCommandRequest")) commands_respond_to_queued_command_result = CommandsRespondToQueuedCommandResult.from_dict(obj.get("CommandsRespondToQueuedCommandResult")) completions_get_trigger_characters_result = CompletionsGetTriggerCharactersResult.from_dict(obj.get("CompletionsGetTriggerCharactersResult")) completions_request_request = CompletionsRequestRequest.from_dict(obj.get("CompletionsRequestRequest")) completions_request_result = CompletionsRequestResult.from_dict(obj.get("CompletionsRequestResult")) configure_session_extensions_params = _ConfigureSessionExtensionsParams.from_dict(obj.get("ConfigureSessionExtensionsParams")) connected_remote_session_metadata = ConnectedRemoteSessionMetadata.from_dict(obj.get("ConnectedRemoteSessionMetadata")) connected_remote_session_metadata_kind = ConnectedRemoteSessionMetadataKind(obj.get("ConnectedRemoteSessionMetadataKind")) connected_remote_session_metadata_repository = ConnectedRemoteSessionMetadataRepository.from_dict(obj.get("ConnectedRemoteSessionMetadataRepository")) connect_remote_session_params = ConnectRemoteSessionParams.from_dict(obj.get("ConnectRemoteSessionParams")) connect_request = _ConnectRequest.from_dict(obj.get("ConnectRequest")) connect_result = _ConnectResult.from_dict(obj.get("ConnectResult")) content_filter_mode = ContentFilterMode(obj.get("ContentFilterMode")) copilot_api_token_auth_info = CopilotAPITokenAuthInfo.from_dict(obj.get("CopilotApiTokenAuthInfo")) copilot_user_response = CopilotUserResponse.from_dict(obj.get("CopilotUserResponse")) copilot_user_response_endpoints = CopilotUserResponseEndpoints.from_dict(obj.get("CopilotUserResponseEndpoints")) copilot_user_response_quota_snapshots = from_dict(lambda x: from_union([CopilotUserResponseQuotaSnapshots.from_dict, from_none], x), obj.get("CopilotUserResponseQuotaSnapshots")) copilot_user_response_quota_snapshots_chat = CopilotUserResponseQuotaSnapshotsChat.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsChat")) copilot_user_response_quota_snapshots_completions = CopilotUserResponseQuotaSnapshotsCompletions.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsCompletions")) copilot_user_response_quota_snapshots_premium_interactions = CopilotUserResponseQuotaSnapshotsPremiumInteractions.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsPremiumInteractions")) current_model = CurrentModel.from_dict(obj.get("CurrentModel")) current_tool_metadata = CurrentToolMetadata.from_dict(obj.get("CurrentToolMetadata")) discovered_canvas = DiscoveredCanvas.from_dict(obj.get("DiscoveredCanvas")) discovered_mcp_server = DiscoveredMCPServer.from_dict(obj.get("DiscoveredMcpServer")) discovered_mcp_server_type = DiscoveredMCPServerType(obj.get("DiscoveredMcpServerType")) enqueue_command_params = EnqueueCommandParams.from_dict(obj.get("EnqueueCommandParams")) enqueue_command_result = EnqueueCommandResult.from_dict(obj.get("EnqueueCommandResult")) env_auth_info = EnvAuthInfo.from_dict(obj.get("EnvAuthInfo")) event_log_read_request = EventLogReadRequest.from_dict(obj.get("EventLogReadRequest")) event_log_release_interest_result = EventLogReleaseInterestResult.from_dict(obj.get("EventLogReleaseInterestResult")) event_log_tail_result = EventLogTailResult.from_dict(obj.get("EventLogTailResult")) event_log_types = from_union([lambda x: from_list(from_str, x), EventLogTypes], obj.get("EventLogTypes")) events_agent_scope = EventsAgentScope(obj.get("EventsAgentScope")) events_cursor_status = EventsCursorStatus(obj.get("EventsCursorStatus")) events_read_result = EventsReadResult.from_dict(obj.get("EventsReadResult")) execute_command_params = ExecuteCommandParams.from_dict(obj.get("ExecuteCommandParams")) execute_command_result = ExecuteCommandResult.from_dict(obj.get("ExecuteCommandResult")) extension = Extension.from_dict(obj.get("Extension")) extension_context_push_input = ExtensionContextPushInput.from_dict(obj.get("ExtensionContextPushInput")) extension_list = ExtensionList.from_dict(obj.get("ExtensionList")) extensions_disable_request = ExtensionsDisableRequest.from_dict(obj.get("ExtensionsDisableRequest")) extensions_enable_request = ExtensionsEnableRequest.from_dict(obj.get("ExtensionsEnableRequest")) extension_source = ExtensionSource(obj.get("ExtensionSource")) extension_status = ExtensionStatus(obj.get("ExtensionStatus")) external_tool_result = from_union([ExternalToolTextResultForLlm.from_dict, from_str], obj.get("ExternalToolResult")) external_tool_text_result_for_llm = ExternalToolTextResultForLlm.from_dict(obj.get("ExternalToolTextResultForLlm")) external_tool_text_result_for_llm_binary_results_for_llm = ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict(obj.get("ExternalToolTextResultForLlmBinaryResultsForLlm")) external_tool_text_result_for_llm_binary_results_for_llm_type = ExternalToolTextResultForLlmBinaryResultsForLlmType(obj.get("ExternalToolTextResultForLlmBinaryResultsForLlmType")) external_tool_text_result_for_llm_content = _load_ExternalToolTextResultForLlmContent(obj.get("ExternalToolTextResultForLlmContent")) external_tool_text_result_for_llm_content_audio = ExternalToolTextResultForLlmContentAudio.from_dict(obj.get("ExternalToolTextResultForLlmContentAudio")) external_tool_text_result_for_llm_content_image = ExternalToolTextResultForLlmContentImage.from_dict(obj.get("ExternalToolTextResultForLlmContentImage")) external_tool_text_result_for_llm_content_resource = ExternalToolTextResultForLlmContentResource.from_dict(obj.get("ExternalToolTextResultForLlmContentResource")) external_tool_text_result_for_llm_content_resource_details = (lambda x: from_union([EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x))(obj.get("ExternalToolTextResultForLlmContentResourceDetails")) external_tool_text_result_for_llm_content_resource_link = ExternalToolTextResultForLlmContentResourceLink.from_dict(obj.get("ExternalToolTextResultForLlmContentResourceLink")) external_tool_text_result_for_llm_content_resource_link_icon = ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict(obj.get("ExternalToolTextResultForLlmContentResourceLinkIcon")) external_tool_text_result_for_llm_content_resource_link_icon_theme = Theme(obj.get("ExternalToolTextResultForLlmContentResourceLinkIconTheme")) external_tool_text_result_for_llm_content_shell_exit = ExternalToolTextResultForLlmContentShellExit.from_dict(obj.get("ExternalToolTextResultForLlmContentShellExit")) external_tool_text_result_for_llm_content_terminal = ExternalToolTextResultForLlmContentTerminal.from_dict(obj.get("ExternalToolTextResultForLlmContentTerminal")) external_tool_text_result_for_llm_content_text = ExternalToolTextResultForLlmContentText.from_dict(obj.get("ExternalToolTextResultForLlmContentText")) filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode], obj.get("FilterMapping")) fleet_start_request = FleetStartRequest.from_dict(obj.get("FleetStartRequest")) fleet_start_result = FleetStartResult.from_dict(obj.get("FleetStartResult")) folder_trust_add_params = FolderTrustAddParams.from_dict(obj.get("FolderTrustAddParams")) folder_trust_check_params = FolderTrustCheckParams.from_dict(obj.get("FolderTrustCheckParams")) folder_trust_check_result = FolderTrustCheckResult.from_dict(obj.get("FolderTrustCheckResult")) gh_cli_auth_info = GhCLIAuthInfo.from_dict(obj.get("GhCliAuthInfo")) git_hub_telemetry_client_info = GitHubTelemetryClientInfo.from_dict(obj.get("GitHubTelemetryClientInfo")) git_hub_telemetry_event = GitHubTelemetryEvent.from_dict(obj.get("GitHubTelemetryEvent")) git_hub_telemetry_notification = GitHubTelemetryNotification.from_dict(obj.get("GitHubTelemetryNotification")) handle_pending_tool_call_request = HandlePendingToolCallRequest.from_dict(obj.get("HandlePendingToolCallRequest")) handle_pending_tool_call_result = HandlePendingToolCallResult.from_dict(obj.get("HandlePendingToolCallResult")) history_abort_manual_compaction_result = HistoryAbortManualCompactionResult.from_dict(obj.get("HistoryAbortManualCompactionResult")) history_cancel_background_compaction_result = HistoryCancelBackgroundCompactionResult.from_dict(obj.get("HistoryCancelBackgroundCompactionResult")) history_compact_context_window = HistoryCompactContextWindow.from_dict(obj.get("HistoryCompactContextWindow")) history_compact_request = HistoryCompactRequest.from_dict(obj.get("HistoryCompactRequest")) history_compact_result = HistoryCompactResult.from_dict(obj.get("HistoryCompactResult")) history_summarize_for_handoff_result = HistorySummarizeForHandoffResult.from_dict(obj.get("HistorySummarizeForHandoffResult")) history_truncate_request = HistoryTruncateRequest.from_dict(obj.get("HistoryTruncateRequest")) history_truncate_result = HistoryTruncateResult.from_dict(obj.get("HistoryTruncateResult")) hmac_auth_info = HMACAuthInfo.from_dict(obj.get("HMACAuthInfo")) installed_plugin = InstalledPlugin.from_dict(obj.get("InstalledPlugin")) installed_plugin_info = InstalledPluginInfo.from_dict(obj.get("InstalledPluginInfo")) installed_plugin_source = from_union([InstalledPluginSource.from_dict, from_str], obj.get("InstalledPluginSource")) installed_plugin_source_git_hub = InstalledPluginSourceGitHub.from_dict(obj.get("InstalledPluginSourceGitHub")) installed_plugin_source_local = InstalledPluginSourceLocal.from_dict(obj.get("InstalledPluginSourceLocal")) installed_plugin_source_url = InstalledPluginSourceURL.from_dict(obj.get("InstalledPluginSourceUrl")) instruction_discovery_path = InstructionDiscoveryPath.from_dict(obj.get("InstructionDiscoveryPath")) instruction_discovery_path_kind = InstructionDiscoveryPathKind(obj.get("InstructionDiscoveryPathKind")) instruction_discovery_path_list = InstructionDiscoveryPathList.from_dict(obj.get("InstructionDiscoveryPathList")) instruction_discovery_path_location = InstructionLocation(obj.get("InstructionDiscoveryPathLocation")) instructions_discover_request = InstructionsDiscoverRequest.from_dict(obj.get("InstructionsDiscoverRequest")) instructions_get_discovery_paths_request = InstructionsGetDiscoveryPathsRequest.from_dict(obj.get("InstructionsGetDiscoveryPathsRequest")) instructions_get_sources_result = InstructionsGetSourcesResult.from_dict(obj.get("InstructionsGetSourcesResult")) instruction_source = InstructionSource.from_dict(obj.get("InstructionSource")) instruction_source_location = InstructionLocation(obj.get("InstructionSourceLocation")) instruction_source_type = InstructionSourceType(obj.get("InstructionSourceType")) llm_inference_headers = from_dict(lambda x: from_list(from_str, x), obj.get("LlmInferenceHeaders")) llm_inference_http_request_chunk_request = LlmInferenceHTTPRequestChunkRequest.from_dict(obj.get("LlmInferenceHttpRequestChunkRequest")) llm_inference_http_request_chunk_result = LlmInferenceHTTPRequestChunkResult.from_dict(obj.get("LlmInferenceHttpRequestChunkResult")) llm_inference_http_request_start_request = LlmInferenceHTTPRequestStartRequest.from_dict(obj.get("LlmInferenceHttpRequestStartRequest")) llm_inference_http_request_start_result = LlmInferenceHTTPRequestStartResult.from_dict(obj.get("LlmInferenceHttpRequestStartResult")) llm_inference_http_request_start_transport = LlmInferenceHTTPRequestStartTransport(obj.get("LlmInferenceHttpRequestStartTransport")) llm_inference_http_response_chunk_error = LlmInferenceHTTPResponseChunkError.from_dict(obj.get("LlmInferenceHttpResponseChunkError")) llm_inference_http_response_chunk_request = LlmInferenceHTTPResponseChunkRequest.from_dict(obj.get("LlmInferenceHttpResponseChunkRequest")) llm_inference_http_response_chunk_result = LlmInferenceHTTPResponseChunkResult.from_dict(obj.get("LlmInferenceHttpResponseChunkResult")) llm_inference_http_response_start_request = LlmInferenceHTTPResponseStartRequest.from_dict(obj.get("LlmInferenceHttpResponseStartRequest")) llm_inference_http_response_start_result = LlmInferenceHTTPResponseStartResult.from_dict(obj.get("LlmInferenceHttpResponseStartResult")) llm_inference_set_provider_result = LlmInferenceSetProviderResult.from_dict(obj.get("LlmInferenceSetProviderResult")) local_session_metadata_value = LocalSessionMetadataValue.from_dict(obj.get("LocalSessionMetadataValue")) log_request = LogRequest.from_dict(obj.get("LogRequest")) log_result = LogResult.from_dict(obj.get("LogResult")) lsp_initialize_request = LspInitializeRequest.from_dict(obj.get("LspInitializeRequest")) marketplace_add_result = MarketplaceAddResult.from_dict(obj.get("MarketplaceAddResult")) marketplace_browse_result = MarketplaceBrowseResult.from_dict(obj.get("MarketplaceBrowseResult")) marketplace_info = MarketplaceInfo.from_dict(obj.get("MarketplaceInfo")) marketplace_list_result = MarketplaceListResult.from_dict(obj.get("MarketplaceListResult")) marketplace_plugin_info = MarketplacePluginInfo.from_dict(obj.get("MarketplacePluginInfo")) marketplace_refresh_entry = MarketplaceRefreshEntry.from_dict(obj.get("MarketplaceRefreshEntry")) marketplace_refresh_result = MarketplaceRefreshResult.from_dict(obj.get("MarketplaceRefreshResult")) marketplace_remove_result = MarketplaceRemoveResult.from_dict(obj.get("MarketplaceRemoveResult")) mcp_allowed_server = MCPAllowedServer.from_dict(obj.get("McpAllowedServer")) mcp_apps_call_tool_request = MCPAppsCallToolRequest.from_dict(obj.get("McpAppsCallToolRequest")) mcp_apps_diagnose_capability = MCPAppsDiagnoseCapability.from_dict(obj.get("McpAppsDiagnoseCapability")) mcp_apps_diagnose_request = MCPAppsDiagnoseRequest.from_dict(obj.get("McpAppsDiagnoseRequest")) mcp_apps_diagnose_result = MCPAppsDiagnoseResult.from_dict(obj.get("McpAppsDiagnoseResult")) mcp_apps_diagnose_server = MCPAppsDiagnoseServer.from_dict(obj.get("McpAppsDiagnoseServer")) mcp_apps_host_context = MCPAppsHostContext.from_dict(obj.get("McpAppsHostContext")) mcp_apps_host_context_details = MCPAppsHostContextDetails.from_dict(obj.get("McpAppsHostContextDetails")) mcp_apps_host_context_details_available_display_mode = MCPAppsDisplayMode(obj.get("McpAppsHostContextDetailsAvailableDisplayMode")) mcp_apps_host_context_details_display_mode = MCPAppsDisplayMode(obj.get("McpAppsHostContextDetailsDisplayMode")) mcp_apps_host_context_details_platform = MCPAppsHostContextDetailsPlatform(obj.get("McpAppsHostContextDetailsPlatform")) mcp_apps_host_context_details_theme = Theme(obj.get("McpAppsHostContextDetailsTheme")) mcp_apps_list_tools_request = MCPAppsListToolsRequest.from_dict(obj.get("McpAppsListToolsRequest")) mcp_apps_list_tools_result = MCPAppsListToolsResult.from_dict(obj.get("McpAppsListToolsResult")) mcp_apps_read_resource_request = MCPAppsReadResourceRequest.from_dict(obj.get("McpAppsReadResourceRequest")) mcp_apps_read_resource_result = MCPAppsReadResourceResult.from_dict(obj.get("McpAppsReadResourceResult")) mcp_apps_resource_content = MCPAppsResourceContent.from_dict(obj.get("McpAppsResourceContent")) mcp_apps_set_host_context_details = MCPAppsSetHostContextDetails.from_dict(obj.get("McpAppsSetHostContextDetails")) mcp_apps_set_host_context_details_available_display_mode = MCPAppsDisplayMode(obj.get("McpAppsSetHostContextDetailsAvailableDisplayMode")) mcp_apps_set_host_context_details_display_mode = MCPAppsDisplayMode(obj.get("McpAppsSetHostContextDetailsDisplayMode")) mcp_apps_set_host_context_details_platform = MCPAppsHostContextDetailsPlatform(obj.get("McpAppsSetHostContextDetailsPlatform")) mcp_apps_set_host_context_details_theme = Theme(obj.get("McpAppsSetHostContextDetailsTheme")) mcp_apps_set_host_context_request = MCPAppsSetHostContextRequest.from_dict(obj.get("McpAppsSetHostContextRequest")) mcp_cancel_sampling_execution_params = MCPCancelSamplingExecutionParams.from_dict(obj.get("McpCancelSamplingExecutionParams")) mcp_cancel_sampling_execution_result = MCPCancelSamplingExecutionResult.from_dict(obj.get("McpCancelSamplingExecutionResult")) mcp_config_add_request = MCPConfigAddRequest.from_dict(obj.get("McpConfigAddRequest")) mcp_config_disable_request = MCPConfigDisableRequest.from_dict(obj.get("McpConfigDisableRequest")) mcp_config_enable_request = MCPConfigEnableRequest.from_dict(obj.get("McpConfigEnableRequest")) mcp_config_list = MCPConfigList.from_dict(obj.get("McpConfigList")) mcp_config_remove_request = MCPConfigRemoveRequest.from_dict(obj.get("McpConfigRemoveRequest")) mcp_config_update_request = MCPConfigUpdateRequest.from_dict(obj.get("McpConfigUpdateRequest")) mcp_configure_git_hub_request = MCPConfigureGitHubRequest.from_dict(obj.get("McpConfigureGitHubRequest")) mcp_configure_git_hub_result = MCPConfigureGitHubResult.from_dict(obj.get("McpConfigureGitHubResult")) mcp_disable_request = MCPDisableRequest.from_dict(obj.get("McpDisableRequest")) mcp_discover_request = MCPDiscoverRequest.from_dict(obj.get("McpDiscoverRequest")) mcp_discover_result = MCPDiscoverResult.from_dict(obj.get("McpDiscoverResult")) mcp_enable_request = MCPEnableRequest.from_dict(obj.get("McpEnableRequest")) mcp_execute_sampling_params = MCPExecuteSamplingParams.from_dict(obj.get("McpExecuteSamplingParams")) mcp_execute_sampling_request = from_dict(lambda x: x, obj.get("McpExecuteSamplingRequest")) mcp_execute_sampling_result = from_dict(lambda x: x, obj.get("McpExecuteSamplingResult")) mcp_filtered_server = MCPFilteredServer.from_dict(obj.get("McpFilteredServer")) mcp_headers_handle_pending_headers_refresh_request = MCPHeadersHandlePendingHeadersRefreshRequest.from_dict(obj.get("McpHeadersHandlePendingHeadersRefreshRequest")) mcp_headers_handle_pending_headers_refresh_request_request = MCPHeadersHandlePendingHeadersRefreshRequestRequest.from_dict(obj.get("McpHeadersHandlePendingHeadersRefreshRequestRequest")) mcp_headers_handle_pending_headers_refresh_request_result = MCPHeadersHandlePendingHeadersRefreshRequestResult.from_dict(obj.get("McpHeadersHandlePendingHeadersRefreshRequestResult")) mcp_host_state = MCPHostState.from_dict(obj.get("McpHostState")) mcp_is_server_running_request = MCPIsServerRunningRequest.from_dict(obj.get("McpIsServerRunningRequest")) mcp_is_server_running_result = MCPIsServerRunningResult.from_dict(obj.get("McpIsServerRunningResult")) mcp_list_tools_request = MCPListToolsRequest.from_dict(obj.get("McpListToolsRequest")) mcp_list_tools_result = MCPListToolsResult.from_dict(obj.get("McpListToolsResult")) mcp_oauth_handle_pending_request = MCPOauthHandlePendingRequest.from_dict(obj.get("McpOauthHandlePendingRequest")) mcp_oauth_handle_pending_result = MCPOauthHandlePendingResult.from_dict(obj.get("McpOauthHandlePendingResult")) mcp_oauth_login_grant_type = MCPGrantType(obj.get("McpOauthLoginGrantType")) mcp_oauth_login_request = MCPOauthLoginRequest.from_dict(obj.get("McpOauthLoginRequest")) mcp_oauth_login_result = MCPOauthLoginResult.from_dict(obj.get("McpOauthLoginResult")) mcp_oauth_pending_request_response = MCPOauthPendingRequestResponse.from_dict(obj.get("McpOauthPendingRequestResponse")) mcp_oauth_respond_request = MCPOauthRespondRequest.from_dict(obj.get("McpOauthRespondRequest")) mcp_oauth_respond_result = MCPOauthRespondResult.from_dict(obj.get("McpOauthRespondResult")) mcp_register_external_client_request = MCPRegisterExternalClientRequest.from_dict(obj.get("McpRegisterExternalClientRequest")) mcp_reload_with_config_request = MCPReloadWithConfigRequest.from_dict(obj.get("McpReloadWithConfigRequest")) mcp_remove_git_hub_result = MCPRemoveGitHubResult.from_dict(obj.get("McpRemoveGitHubResult")) mcp_restart_server_request = MCPRestartServerRequest.from_dict(obj.get("McpRestartServerRequest")) mcp_sampling_execution_action = MCPSamplingExecutionAction(obj.get("McpSamplingExecutionAction")) mcp_sampling_execution_result = MCPSamplingExecutionResult.from_dict(obj.get("McpSamplingExecutionResult")) mcp_server = MCPServer.from_dict(obj.get("McpServer")) mcp_server_auth_config = from_union([from_bool, MCPServerAuthConfigRedirectPort.from_dict], obj.get("McpServerAuthConfig")) mcp_server_auth_config_redirect_port = MCPServerAuthConfigRedirectPort.from_dict(obj.get("McpServerAuthConfigRedirectPort")) mcp_server_config = MCPServerConfig.from_dict(obj.get("McpServerConfig")) mcp_server_config_defer_tools = MCPServerConfigDeferTools(obj.get("McpServerConfigDeferTools")) mcp_server_config_http = MCPServerConfigHTTP.from_dict(obj.get("McpServerConfigHttp")) mcp_server_config_http_oauth_grant_type = MCPGrantType(obj.get("McpServerConfigHttpOauthGrantType")) mcp_server_config_http_type = MCPServerConfigHTTPType(obj.get("McpServerConfigHttpType")) mcp_server_config_stdio = MCPServerConfigStdio.from_dict(obj.get("McpServerConfigStdio")) mcp_server_failure_info = MCPServerFailureInfo.from_dict(obj.get("McpServerFailureInfo")) mcp_server_list = MCPServerList.from_dict(obj.get("McpServerList")) mcp_server_needs_auth_info = MCPServerNeedsAuthInfo.from_dict(obj.get("McpServerNeedsAuthInfo")) mcp_set_env_value_mode_details = MCPSetEnvValueModeDetails(obj.get("McpSetEnvValueModeDetails")) mcp_set_env_value_mode_params = MCPSetEnvValueModeParams.from_dict(obj.get("McpSetEnvValueModeParams")) mcp_set_env_value_mode_result = MCPSetEnvValueModeResult.from_dict(obj.get("McpSetEnvValueModeResult")) mcp_start_server_request = MCPStartServerRequest.from_dict(obj.get("McpStartServerRequest")) mcp_start_servers_result = MCPStartServersResult.from_dict(obj.get("McpStartServersResult")) mcp_stop_server_request = MCPStopServerRequest.from_dict(obj.get("McpStopServerRequest")) mcp_tools = MCPTools.from_dict(obj.get("McpTools")) mcp_unregister_external_client_request = MCPUnregisterExternalClientRequest.from_dict(obj.get("McpUnregisterExternalClientRequest")) memory_configuration = MemoryConfiguration.from_dict(obj.get("MemoryConfiguration")) metadata_context_info_request = MetadataContextInfoRequest.from_dict(obj.get("MetadataContextInfoRequest")) metadata_context_info_result = MetadataContextInfoResult.from_dict(obj.get("MetadataContextInfoResult")) metadata_is_processing_result = MetadataIsProcessingResult.from_dict(obj.get("MetadataIsProcessingResult")) metadata_recompute_context_tokens_request = MetadataRecomputeContextTokensRequest.from_dict(obj.get("MetadataRecomputeContextTokensRequest")) metadata_recompute_context_tokens_result = MetadataRecomputeContextTokensResult.from_dict(obj.get("MetadataRecomputeContextTokensResult")) metadata_record_context_change_request = MetadataRecordContextChangeRequest.from_dict(obj.get("MetadataRecordContextChangeRequest")) metadata_record_context_change_result = MetadataRecordContextChangeResult.from_dict(obj.get("MetadataRecordContextChangeResult")) metadata_set_working_directory_request = MetadataSetWorkingDirectoryRequest.from_dict(obj.get("MetadataSetWorkingDirectoryRequest")) metadata_set_working_directory_result = MetadataSetWorkingDirectoryResult.from_dict(obj.get("MetadataSetWorkingDirectoryResult")) metadata_snapshot_current_mode = MetadataSnapshotCurrentMode(obj.get("MetadataSnapshotCurrentMode")) metadata_snapshot_remote_metadata = MetadataSnapshotRemoteMetadata.from_dict(obj.get("MetadataSnapshotRemoteMetadata")) metadata_snapshot_remote_metadata_repository = MetadataSnapshotRemoteMetadataRepository.from_dict(obj.get("MetadataSnapshotRemoteMetadataRepository")) metadata_snapshot_remote_metadata_task_type = TaskType(obj.get("MetadataSnapshotRemoteMetadataTaskType")) model = Model.from_dict(obj.get("Model")) model_billing = ModelBilling.from_dict(obj.get("ModelBilling")) model_billing_token_prices = ModelBillingTokenPrices.from_dict(obj.get("ModelBillingTokenPrices")) model_billing_token_prices_long_context = ModelBillingTokenPricesLongContext.from_dict(obj.get("ModelBillingTokenPricesLongContext")) model_capabilities = ModelCapabilities.from_dict(obj.get("ModelCapabilities")) model_capabilities_limits = ModelCapabilitiesLimits.from_dict(obj.get("ModelCapabilitiesLimits")) model_capabilities_limits_vision = ModelCapabilitiesLimitsVision.from_dict(obj.get("ModelCapabilitiesLimitsVision")) model_capabilities_override = ModelCapabilitiesOverride.from_dict(obj.get("ModelCapabilitiesOverride")) model_capabilities_override_limits = ModelCapabilitiesOverrideLimits.from_dict(obj.get("ModelCapabilitiesOverrideLimits")) model_capabilities_override_limits_vision = ModelCapabilitiesOverrideLimitsVision.from_dict(obj.get("ModelCapabilitiesOverrideLimitsVision")) model_capabilities_override_supports = ModelCapabilitiesOverrideSupports.from_dict(obj.get("ModelCapabilitiesOverrideSupports")) model_capabilities_supports = ModelCapabilitiesSupports.from_dict(obj.get("ModelCapabilitiesSupports")) model_list = ModelList.from_dict(obj.get("ModelList")) model_list_request = ModelListRequest.from_dict(obj.get("ModelListRequest")) model_picker_category = ModelPickerCategory(obj.get("ModelPickerCategory")) model_picker_price_category = ModelPickerPriceCategory(obj.get("ModelPickerPriceCategory")) model_policy = ModelPolicy.from_dict(obj.get("ModelPolicy")) model_policy_state = ModelPolicyState(obj.get("ModelPolicyState")) model_set_reasoning_effort_request = ModelSetReasoningEffortRequest.from_dict(obj.get("ModelSetReasoningEffortRequest")) model_set_reasoning_effort_result = ModelSetReasoningEffortResult.from_dict(obj.get("ModelSetReasoningEffortResult")) models_list_request = ModelsListRequest.from_dict(obj.get("ModelsListRequest")) model_switch_to_request = ModelSwitchToRequest.from_dict(obj.get("ModelSwitchToRequest")) model_switch_to_result = ModelSwitchToResult.from_dict(obj.get("ModelSwitchToResult")) mode_set_request = ModeSetRequest.from_dict(obj.get("ModeSetRequest")) named_provider_config = NamedProviderConfig.from_dict(obj.get("NamedProviderConfig")) name_get_result = NameGetResult.from_dict(obj.get("NameGetResult")) name_set_auto_request = NameSetAutoRequest.from_dict(obj.get("NameSetAutoRequest")) name_set_auto_result = NameSetAutoResult.from_dict(obj.get("NameSetAutoResult")) name_set_request = NameSetRequest.from_dict(obj.get("NameSetRequest")) open_canvas_instance = OpenCanvasInstance.from_dict(obj.get("OpenCanvasInstance")) options_update_additional_content_exclusion_policy = OptionsUpdateAdditionalContentExclusionPolicy.from_dict(obj.get("OptionsUpdateAdditionalContentExclusionPolicy")) options_update_additional_content_exclusion_policy_rule = OptionsUpdateAdditionalContentExclusionPolicyRule.from_dict(obj.get("OptionsUpdateAdditionalContentExclusionPolicyRule")) options_update_additional_content_exclusion_policy_rule_source = OptionsUpdateAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("OptionsUpdateAdditionalContentExclusionPolicyRuleSource")) options_update_additional_content_exclusion_policy_scope = AdditionalContentExclusionPolicyScope(obj.get("OptionsUpdateAdditionalContentExclusionPolicyScope")) options_update_context_tier = OptionsUpdateContextTier(obj.get("OptionsUpdateContextTier")) options_update_env_value_mode = MCPSetEnvValueModeDetails(obj.get("OptionsUpdateEnvValueMode")) options_update_reasoning_summary = ReasoningSummary(obj.get("OptionsUpdateReasoningSummary")) options_update_tool_filter_precedence = OptionsUpdateToolFilterPrecedence(obj.get("OptionsUpdateToolFilterPrecedence")) pending_permission_request = PendingPermissionRequest.from_dict(obj.get("PendingPermissionRequest")) pending_permission_request_list = PendingPermissionRequestList.from_dict(obj.get("PendingPermissionRequestList")) permission_decision = _load_PermissionDecision(obj.get("PermissionDecision")) permission_decision_approved = PermissionDecisionApproved.from_dict(obj.get("PermissionDecisionApproved")) permission_decision_approved_for_location = PermissionDecisionApprovedForLocation.from_dict(obj.get("PermissionDecisionApprovedForLocation")) permission_decision_approved_for_session = PermissionDecisionApprovedForSession.from_dict(obj.get("PermissionDecisionApprovedForSession")) permission_decision_approve_for_location = PermissionDecisionApproveForLocation.from_dict(obj.get("PermissionDecisionApproveForLocation")) permission_decision_approve_for_location_approval = _load_PermissionDecisionApproveForLocationApproval(obj.get("PermissionDecisionApproveForLocationApproval")) permission_decision_approve_for_location_approval_commands = PermissionDecisionApproveForLocationApprovalCommands.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalCommands")) permission_decision_approve_for_location_approval_custom_tool = PermissionDecisionApproveForLocationApprovalCustomTool.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalCustomTool")) permission_decision_approve_for_location_approval_extension_management = PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalExtensionManagement")) permission_decision_approve_for_location_approval_extension_permission_access = PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess")) permission_decision_approve_for_location_approval_mcp = PermissionDecisionApproveForLocationApprovalMCP.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMcp")) permission_decision_approve_for_location_approval_mcp_sampling = PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMcpSampling")) permission_decision_approve_for_location_approval_memory = PermissionDecisionApproveForLocationApprovalMemory.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMemory")) permission_decision_approve_for_location_approval_read = PermissionDecisionApproveForLocationApprovalRead.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalRead")) permission_decision_approve_for_location_approval_write = PermissionDecisionApproveForLocationApprovalWrite.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalWrite")) permission_decision_approve_for_session = PermissionDecisionApproveForSession.from_dict(obj.get("PermissionDecisionApproveForSession")) permission_decision_approve_for_session_approval = _load_PermissionDecisionApproveForSessionApproval(obj.get("PermissionDecisionApproveForSessionApproval")) permission_decision_approve_for_session_approval_commands = PermissionDecisionApproveForSessionApprovalCommands.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalCommands")) permission_decision_approve_for_session_approval_custom_tool = PermissionDecisionApproveForSessionApprovalCustomTool.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalCustomTool")) permission_decision_approve_for_session_approval_extension_management = PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalExtensionManagement")) permission_decision_approve_for_session_approval_extension_permission_access = PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess")) permission_decision_approve_for_session_approval_mcp = PermissionDecisionApproveForSessionApprovalMCP.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMcp")) permission_decision_approve_for_session_approval_mcp_sampling = PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMcpSampling")) permission_decision_approve_for_session_approval_memory = PermissionDecisionApproveForSessionApprovalMemory.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMemory")) permission_decision_approve_for_session_approval_read = PermissionDecisionApproveForSessionApprovalRead.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalRead")) permission_decision_approve_for_session_approval_write = PermissionDecisionApproveForSessionApprovalWrite.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalWrite")) permission_decision_approve_once = PermissionDecisionApproveOnce.from_dict(obj.get("PermissionDecisionApproveOnce")) permission_decision_approve_permanently = PermissionDecisionApprovePermanently.from_dict(obj.get("PermissionDecisionApprovePermanently")) permission_decision_cancelled = PermissionDecisionCancelled.from_dict(obj.get("PermissionDecisionCancelled")) permission_decision_denied_by_content_exclusion_policy = PermissionDecisionDeniedByContentExclusionPolicy.from_dict(obj.get("PermissionDecisionDeniedByContentExclusionPolicy")) permission_decision_denied_by_permission_request_hook = PermissionDecisionDeniedByPermissionRequestHook.from_dict(obj.get("PermissionDecisionDeniedByPermissionRequestHook")) permission_decision_denied_by_rules = PermissionDecisionDeniedByRules.from_dict(obj.get("PermissionDecisionDeniedByRules")) permission_decision_denied_interactively_by_user = PermissionDecisionDeniedInteractivelyByUser.from_dict(obj.get("PermissionDecisionDeniedInteractivelyByUser")) permission_decision_denied_no_approval_rule_and_could_not_request_from_user = PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict(obj.get("PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser")) permission_decision_reject = PermissionDecisionReject.from_dict(obj.get("PermissionDecisionReject")) permission_decision_request = PermissionDecisionRequest.from_dict(obj.get("PermissionDecisionRequest")) permission_decision_user_not_available = PermissionDecisionUserNotAvailable.from_dict(obj.get("PermissionDecisionUserNotAvailable")) permission_location_add_tool_approval_params = PermissionLocationAddToolApprovalParams.from_dict(obj.get("PermissionLocationAddToolApprovalParams")) permission_location_apply_params = PermissionLocationApplyParams.from_dict(obj.get("PermissionLocationApplyParams")) permission_location_apply_result = PermissionLocationApplyResult.from_dict(obj.get("PermissionLocationApplyResult")) permission_location_resolve_params = PermissionLocationResolveParams.from_dict(obj.get("PermissionLocationResolveParams")) permission_location_resolve_result = PermissionLocationResolveResult.from_dict(obj.get("PermissionLocationResolveResult")) permission_location_type = PermissionLocationType(obj.get("PermissionLocationType")) permission_paths_add_params = PermissionPathsAddParams.from_dict(obj.get("PermissionPathsAddParams")) permission_paths_allowed_check_params = PermissionPathsAllowedCheckParams.from_dict(obj.get("PermissionPathsAllowedCheckParams")) permission_paths_allowed_check_result = PermissionPathsAllowedCheckResult.from_dict(obj.get("PermissionPathsAllowedCheckResult")) permission_paths_config = PermissionPathsConfig.from_dict(obj.get("PermissionPathsConfig")) permission_paths_list = PermissionPathsList.from_dict(obj.get("PermissionPathsList")) permission_paths_update_primary_params = PermissionPathsUpdatePrimaryParams.from_dict(obj.get("PermissionPathsUpdatePrimaryParams")) permission_paths_workspace_check_params = PermissionPathsWorkspaceCheckParams.from_dict(obj.get("PermissionPathsWorkspaceCheckParams")) permission_paths_workspace_check_result = PermissionPathsWorkspaceCheckResult.from_dict(obj.get("PermissionPathsWorkspaceCheckResult")) permission_prompt_shown_notification = PermissionPromptShownNotification.from_dict(obj.get("PermissionPromptShownNotification")) permission_request_result = PermissionRequestResult.from_dict(obj.get("PermissionRequestResult")) permission_rules_set = PermissionRulesSet.from_dict(obj.get("PermissionRulesSet")) permissions_configure_additional_content_exclusion_policy = PermissionsConfigureAdditionalContentExclusionPolicy.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicy")) permissions_configure_additional_content_exclusion_policy_rule = PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRule")) permissions_configure_additional_content_exclusion_policy_rule_source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRuleSource")) permissions_configure_additional_content_exclusion_policy_scope = AdditionalContentExclusionPolicyScope(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyScope")) permissions_configure_params = PermissionsConfigureParams.from_dict(obj.get("PermissionsConfigureParams")) permissions_configure_result = PermissionsConfigureResult.from_dict(obj.get("PermissionsConfigureResult")) permissions_folder_trust_add_trusted_result = PermissionsFolderTrustAddTrustedResult.from_dict(obj.get("PermissionsFolderTrustAddTrustedResult")) permissions_get_allow_all_request = PermissionsGetAllowAllRequest.from_dict(obj.get("PermissionsGetAllowAllRequest")) permissions_locations_add_tool_approval_details = _load_PermissionsLocationsAddToolApprovalDetails(obj.get("PermissionsLocationsAddToolApprovalDetails")) permissions_locations_add_tool_approval_details_commands = PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsCommands")) permissions_locations_add_tool_approval_details_custom_tool = PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsCustomTool")) permissions_locations_add_tool_approval_details_extension_management = PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionManagement")) permissions_locations_add_tool_approval_details_extension_permission_access = PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess")) permissions_locations_add_tool_approval_details_mcp = PermissionsLocationsAddToolApprovalDetailsMCP.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMcp")) permissions_locations_add_tool_approval_details_mcp_sampling = PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMcpSampling")) permissions_locations_add_tool_approval_details_memory = PermissionsLocationsAddToolApprovalDetailsMemory.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMemory")) permissions_locations_add_tool_approval_details_read = PermissionsLocationsAddToolApprovalDetailsRead.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsRead")) permissions_locations_add_tool_approval_details_write = PermissionsLocationsAddToolApprovalDetailsWrite.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsWrite")) permissions_locations_add_tool_approval_result = PermissionsLocationsAddToolApprovalResult.from_dict(obj.get("PermissionsLocationsAddToolApprovalResult")) permissions_modify_rules_params = PermissionsModifyRulesParams.from_dict(obj.get("PermissionsModifyRulesParams")) permissions_modify_rules_result = PermissionsModifyRulesResult.from_dict(obj.get("PermissionsModifyRulesResult")) permissions_modify_rules_scope = PermissionsModifyRulesScope(obj.get("PermissionsModifyRulesScope")) permissions_notify_prompt_shown_result = PermissionsNotifyPromptShownResult.from_dict(obj.get("PermissionsNotifyPromptShownResult")) permissions_paths_add_result = PermissionsPathsAddResult.from_dict(obj.get("PermissionsPathsAddResult")) permissions_paths_list_request = PermissionsPathsListRequest.from_dict(obj.get("PermissionsPathsListRequest")) permissions_paths_update_primary_result = PermissionsPathsUpdatePrimaryResult.from_dict(obj.get("PermissionsPathsUpdatePrimaryResult")) permissions_pending_requests_request = PermissionsPendingRequestsRequest.from_dict(obj.get("PermissionsPendingRequestsRequest")) permissions_reset_session_approvals_request = PermissionsResetSessionApprovalsRequest.from_dict(obj.get("PermissionsResetSessionApprovalsRequest")) permissions_reset_session_approvals_result = PermissionsResetSessionApprovalsResult.from_dict(obj.get("PermissionsResetSessionApprovalsResult")) permissions_set_allow_all_request = PermissionsSetAllowAllRequest.from_dict(obj.get("PermissionsSetAllowAllRequest")) permissions_set_allow_all_source = PermissionsSetAAllSource(obj.get("PermissionsSetAllowAllSource")) permissions_set_approve_all_request = PermissionsSetApproveAllRequest.from_dict(obj.get("PermissionsSetApproveAllRequest")) permissions_set_approve_all_result = PermissionsSetApproveAllResult.from_dict(obj.get("PermissionsSetApproveAllResult")) permissions_set_approve_all_source = PermissionsSetAAllSource(obj.get("PermissionsSetApproveAllSource")) permissions_set_required_request = PermissionsSetRequiredRequest.from_dict(obj.get("PermissionsSetRequiredRequest")) permissions_set_required_result = PermissionsSetRequiredResult.from_dict(obj.get("PermissionsSetRequiredResult")) permissions_urls_set_unrestricted_mode_result = PermissionsUrlsSetUnrestrictedModeResult.from_dict(obj.get("PermissionsUrlsSetUnrestrictedModeResult")) permission_urls_config = PermissionUrlsConfig.from_dict(obj.get("PermissionUrlsConfig")) permission_urls_set_unrestricted_mode_params = PermissionUrlsSetUnrestrictedModeParams.from_dict(obj.get("PermissionUrlsSetUnrestrictedModeParams")) ping_request = PingRequest.from_dict(obj.get("PingRequest")) ping_result = PingResult.from_dict(obj.get("PingResult")) plan_read_result = PlanReadResult.from_dict(obj.get("PlanReadResult")) plan_read_sql_todos_result = PlanReadSQLTodosResult.from_dict(obj.get("PlanReadSqlTodosResult")) plan_read_sql_todos_with_dependencies_result = PlanReadSQLTodosWithDependenciesResult.from_dict(obj.get("PlanReadSqlTodosWithDependenciesResult")) plan_sql_todo_dependency = PlanSQLTodoDependency.from_dict(obj.get("PlanSqlTodoDependency")) plan_sql_todos_row = PlanSQLTodosRow.from_dict(obj.get("PlanSqlTodosRow")) plan_update_request = PlanUpdateRequest.from_dict(obj.get("PlanUpdateRequest")) plugin = Plugin.from_dict(obj.get("Plugin")) plugin_install_result = PluginInstallResult.from_dict(obj.get("PluginInstallResult")) plugin_list = PluginList.from_dict(obj.get("PluginList")) plugin_list_result = PluginListResult.from_dict(obj.get("PluginListResult")) plugins_disable_request = PluginsDisableRequest.from_dict(obj.get("PluginsDisableRequest")) plugins_enable_request = PluginsEnableRequest.from_dict(obj.get("PluginsEnableRequest")) plugins_install_request = PluginsInstallRequest.from_dict(obj.get("PluginsInstallRequest")) plugins_marketplaces_add_request = PluginsMarketplacesAddRequest.from_dict(obj.get("PluginsMarketplacesAddRequest")) plugins_marketplaces_browse_request = PluginsMarketplacesBrowseRequest.from_dict(obj.get("PluginsMarketplacesBrowseRequest")) plugins_marketplaces_refresh_request = PluginsMarketplacesRefreshRequest.from_dict(obj.get("PluginsMarketplacesRefreshRequest")) plugins_marketplaces_remove_request = PluginsMarketplacesRemoveRequest.from_dict(obj.get("PluginsMarketplacesRemoveRequest")) plugins_reload_request = PluginsReloadRequest.from_dict(obj.get("PluginsReloadRequest")) plugins_uninstall_request = PluginsUninstallRequest.from_dict(obj.get("PluginsUninstallRequest")) plugins_update_request = PluginsUpdateRequest.from_dict(obj.get("PluginsUpdateRequest")) plugin_update_all_entry = PluginUpdateAllEntry.from_dict(obj.get("PluginUpdateAllEntry")) plugin_update_all_result = PluginUpdateAllResult.from_dict(obj.get("PluginUpdateAllResult")) plugin_update_result = PluginUpdateResult.from_dict(obj.get("PluginUpdateResult")) poll_spawned_sessions_result = PollSpawnedSessionsResult.from_dict(obj.get("PollSpawnedSessionsResult")) provider_add_request = ProviderAddRequest.from_dict(obj.get("ProviderAddRequest")) provider_add_result = ProviderAddResult.from_dict(obj.get("ProviderAddResult")) provider_config = ProviderConfig.from_dict(obj.get("ProviderConfig")) provider_config_azure = ProviderConfigAzure.from_dict(obj.get("ProviderConfigAzure")) provider_config_transport = ProviderTransport(obj.get("ProviderConfigTransport")) provider_config_type = ProviderType(obj.get("ProviderConfigType")) provider_config_wire_api = ProviderWireAPI(obj.get("ProviderConfigWireApi")) provider_endpoint = ProviderEndpoint.from_dict(obj.get("ProviderEndpoint")) provider_endpoint_transport = ProviderTransport(obj.get("ProviderEndpointTransport")) provider_endpoint_type = ProviderType(obj.get("ProviderEndpointType")) provider_endpoint_wire_api = ProviderWireAPI(obj.get("ProviderEndpointWireApi")) provider_get_endpoint_request = ProviderGetEndpointRequest.from_dict(obj.get("ProviderGetEndpointRequest")) provider_model_config = ProviderModelConfig.from_dict(obj.get("ProviderModelConfig")) provider_session_token = ProviderSessionToken.from_dict(obj.get("ProviderSessionToken")) provider_token_acquire_request = ProviderTokenAcquireRequest.from_dict(obj.get("ProviderTokenAcquireRequest")) provider_token_acquire_result = ProviderTokenAcquireResult.from_dict(obj.get("ProviderTokenAcquireResult")) push_attachment = _load_PushAttachment(obj.get("PushAttachment")) push_attachment_blob = PushAttachmentBlob.from_dict(obj.get("PushAttachmentBlob")) push_attachment_directory = PushAttachmentDirectory.from_dict(obj.get("PushAttachmentDirectory")) push_attachment_file = PushAttachmentFile.from_dict(obj.get("PushAttachmentFile")) push_attachment_file_line_range = PushAttachmentFileLineRange.from_dict(obj.get("PushAttachmentFileLineRange")) push_attachment_git_hub_actions_job = PushAttachmentGitHubActionsJob.from_dict(obj.get("PushAttachmentGitHubActionsJob")) push_attachment_git_hub_commit = PushAttachmentGitHubCommit.from_dict(obj.get("PushAttachmentGitHubCommit")) push_attachment_git_hub_file = PushAttachmentGitHubFile.from_dict(obj.get("PushAttachmentGitHubFile")) push_attachment_git_hub_file_diff = PushAttachmentGitHubFileDiff.from_dict(obj.get("PushAttachmentGitHubFileDiff")) push_attachment_git_hub_file_diff_side = PushAttachmentGitHubFileDiffSide.from_dict(obj.get("PushAttachmentGitHubFileDiffSide")) push_attachment_git_hub_reference = PushAttachmentGitHubReference.from_dict(obj.get("PushAttachmentGitHubReference")) push_attachment_git_hub_reference_type = PushAttachmentGitHubReferenceTypeEnum(obj.get("PushAttachmentGitHubReferenceType")) push_attachment_git_hub_release = PushAttachmentGitHubRelease.from_dict(obj.get("PushAttachmentGitHubRelease")) push_attachment_git_hub_repository = PushAttachmentGitHubRepository.from_dict(obj.get("PushAttachmentGitHubRepository")) push_attachment_git_hub_snippet = PushAttachmentGitHubSnippet.from_dict(obj.get("PushAttachmentGitHubSnippet")) push_attachment_git_hub_tree_comparison = PushAttachmentGitHubTreeComparison.from_dict(obj.get("PushAttachmentGitHubTreeComparison")) push_attachment_git_hub_tree_comparison_side = PushAttachmentGitHubTreeComparisonSide.from_dict(obj.get("PushAttachmentGitHubTreeComparisonSide")) push_attachment_git_hub_url = PushAttachmentGitHubURL.from_dict(obj.get("PushAttachmentGitHubUrl")) push_attachment_selection = PushAttachmentSelection.from_dict(obj.get("PushAttachmentSelection")) push_attachment_selection_details = PushAttachmentSelectionDetails.from_dict(obj.get("PushAttachmentSelectionDetails")) push_attachment_selection_details_end = PushAttachmentSelectionDetailsEnd.from_dict(obj.get("PushAttachmentSelectionDetailsEnd")) push_attachment_selection_details_start = PushAttachmentSelectionDetailsStart.from_dict(obj.get("PushAttachmentSelectionDetailsStart")) push_git_hub_repo_ref = PushGitHubRepoRef.from_dict(obj.get("PushGitHubRepoRef")) queued_command_handled = QueuedCommandHandled.from_dict(obj.get("QueuedCommandHandled")) queued_command_not_handled = QueuedCommandNotHandled.from_dict(obj.get("QueuedCommandNotHandled")) queued_command_result = _load_QueuedCommandResult(obj.get("QueuedCommandResult")) queue_pending_items = QueuePendingItems.from_dict(obj.get("QueuePendingItems")) queue_pending_items_kind = QueuePendingItemsKind(obj.get("QueuePendingItemsKind")) queue_pending_items_result = QueuePendingItemsResult.from_dict(obj.get("QueuePendingItemsResult")) queue_remove_most_recent_result = QueueRemoveMostRecentResult.from_dict(obj.get("QueueRemoveMostRecentResult")) register_event_interest_params = RegisterEventInterestParams.from_dict(obj.get("RegisterEventInterestParams")) register_event_interest_result = RegisterEventInterestResult.from_dict(obj.get("RegisterEventInterestResult")) register_extension_tools_params = _RegisterExtensionToolsParams.from_dict(obj.get("RegisterExtensionToolsParams")) register_extension_tools_result = _RegisterExtensionToolsResult.from_dict(obj.get("RegisterExtensionToolsResult")) release_event_interest_params = ReleaseEventInterestParams.from_dict(obj.get("ReleaseEventInterestParams")) remote_control_config = RemoteControlConfig.from_dict(obj.get("RemoteControlConfig")) remote_control_config_existing_mc_session = RemoteControlConfigExistingMcSession.from_dict(obj.get("RemoteControlConfigExistingMcSession")) remote_control_status = _load_RemoteControlStatus(obj.get("RemoteControlStatus")) remote_control_status_active = RemoteControlStatusActive.from_dict(obj.get("RemoteControlStatusActive")) remote_control_status_connecting = RemoteControlStatusConnecting.from_dict(obj.get("RemoteControlStatusConnecting")) remote_control_status_error = RemoteControlStatusError.from_dict(obj.get("RemoteControlStatusError")) remote_control_status_off = RemoteControlStatusOff.from_dict(obj.get("RemoteControlStatusOff")) remote_control_status_result = RemoteControlStatusResult.from_dict(obj.get("RemoteControlStatusResult")) remote_control_stop_result = RemoteControlStopResult.from_dict(obj.get("RemoteControlStopResult")) remote_control_transfer_result = RemoteControlTransferResult.from_dict(obj.get("RemoteControlTransferResult")) remote_enable_request = RemoteEnableRequest.from_dict(obj.get("RemoteEnableRequest")) remote_enable_result = RemoteEnableResult.from_dict(obj.get("RemoteEnableResult")) remote_notify_steerable_changed_request = RemoteNotifySteerableChangedRequest.from_dict(obj.get("RemoteNotifySteerableChangedRequest")) remote_notify_steerable_changed_result = RemoteNotifySteerableChangedResult.from_dict(obj.get("RemoteNotifySteerableChangedResult")) remote_session_connection_result = RemoteSessionConnectionResult.from_dict(obj.get("RemoteSessionConnectionResult")) remote_session_metadata_repository = RemoteSessionMetadataRepository.from_dict(obj.get("RemoteSessionMetadataRepository")) remote_session_metadata_task_type = TaskType(obj.get("RemoteSessionMetadataTaskType")) remote_session_metadata_value = RemoteSessionMetadataValue.from_dict(obj.get("RemoteSessionMetadataValue")) remote_session_mode = RemoteSessionMode(obj.get("RemoteSessionMode")) remote_session_repository = RemoteSessionRepository.from_dict(obj.get("RemoteSessionRepository")) sandbox_config = SandboxConfig.from_dict(obj.get("SandboxConfig")) sandbox_config_user_policy = SandboxConfigUserPolicy.from_dict(obj.get("SandboxConfigUserPolicy")) sandbox_config_user_policy_experimental = SandboxConfigUserPolicyExperimental.from_dict(obj.get("SandboxConfigUserPolicyExperimental")) sandbox_config_user_policy_experimental_seatbelt = SandboxConfigUserPolicyExperimentalSeatbelt.from_dict(obj.get("SandboxConfigUserPolicyExperimentalSeatbelt")) sandbox_config_user_policy_filesystem = SandboxConfigUserPolicyFilesystem.from_dict(obj.get("SandboxConfigUserPolicyFilesystem")) sandbox_config_user_policy_network = SandboxConfigUserPolicyNetwork.from_dict(obj.get("SandboxConfigUserPolicyNetwork")) sandbox_config_user_policy_seatbelt = SandboxConfigUserPolicySeatbelt.from_dict(obj.get("SandboxConfigUserPolicySeatbelt")) schedule_entry = ScheduleEntry.from_dict(obj.get("ScheduleEntry")) schedule_list = ScheduleList.from_dict(obj.get("ScheduleList")) schedule_stop_request = ScheduleStopRequest.from_dict(obj.get("ScheduleStopRequest")) schedule_stop_result = ScheduleStopResult.from_dict(obj.get("ScheduleStopResult")) secrets_add_filter_values_request = SecretsAddFilterValuesRequest.from_dict(obj.get("SecretsAddFilterValuesRequest")) secrets_add_filter_values_result = SecretsAddFilterValuesResult.from_dict(obj.get("SecretsAddFilterValuesResult")) send_agent_mode = SendAgentMode(obj.get("SendAgentMode")) send_attachments_to_message_params = SendAttachmentsToMessageParams.from_dict(obj.get("SendAttachmentsToMessageParams")) send_mode = SendMode(obj.get("SendMode")) send_request = SendRequest.from_dict(obj.get("SendRequest")) send_result = SendResult.from_dict(obj.get("SendResult")) server_agent_list = ServerAgentList.from_dict(obj.get("ServerAgentList")) server_instruction_source_list = ServerInstructionSourceList.from_dict(obj.get("ServerInstructionSourceList")) server_skill = ServerSkill.from_dict(obj.get("ServerSkill")) server_skill_list = ServerSkillList.from_dict(obj.get("ServerSkillList")) session_activity = SessionActivity.from_dict(obj.get("SessionActivity")) session_auth_status = SessionAuthStatus.from_dict(obj.get("SessionAuthStatus")) session_bulk_delete_result = SessionBulkDeleteResult.from_dict(obj.get("SessionBulkDeleteResult")) session_capability = SessionCapability(obj.get("SessionCapability")) session_completion_item = SessionCompletionItem.from_dict(obj.get("SessionCompletionItem")) session_context = SessionContext.from_dict(obj.get("SessionContext")) session_context_host_type = HostType(obj.get("SessionContextHostType")) session_enrich_metadata_result = SessionEnrichMetadataResult.from_dict(obj.get("SessionEnrichMetadataResult")) session_fs_append_file_request = SessionFSAppendFileRequest.from_dict(obj.get("SessionFsAppendFileRequest")) session_fs_error = SessionFSError.from_dict(obj.get("SessionFsError")) session_fs_error_code = SessionFSErrorCode(obj.get("SessionFsErrorCode")) session_fs_exists_request = SessionFSExistsRequest.from_dict(obj.get("SessionFsExistsRequest")) session_fs_exists_result = SessionFSExistsResult.from_dict(obj.get("SessionFsExistsResult")) session_fs_mkdir_request = SessionFSMkdirRequest.from_dict(obj.get("SessionFsMkdirRequest")) session_fs_readdir_request = SessionFSReaddirRequest.from_dict(obj.get("SessionFsReaddirRequest")) session_fs_readdir_result = SessionFSReaddirResult.from_dict(obj.get("SessionFsReaddirResult")) session_fs_readdir_with_types_entry = SessionFSReaddirWithTypesEntry.from_dict(obj.get("SessionFsReaddirWithTypesEntry")) session_fs_readdir_with_types_entry_type = InstructionDiscoveryPathKind(obj.get("SessionFsReaddirWithTypesEntryType")) session_fs_readdir_with_types_request = SessionFSReaddirWithTypesRequest.from_dict(obj.get("SessionFsReaddirWithTypesRequest")) session_fs_readdir_with_types_result = SessionFSReaddirWithTypesResult.from_dict(obj.get("SessionFsReaddirWithTypesResult")) session_fs_read_file_request = SessionFSReadFileRequest.from_dict(obj.get("SessionFsReadFileRequest")) session_fs_read_file_result = SessionFSReadFileResult.from_dict(obj.get("SessionFsReadFileResult")) session_fs_rename_request = SessionFSRenameRequest.from_dict(obj.get("SessionFsRenameRequest")) session_fs_rm_request = SessionFSRmRequest.from_dict(obj.get("SessionFsRmRequest")) session_fs_set_provider_capabilities = SessionFSSetProviderCapabilities.from_dict(obj.get("SessionFsSetProviderCapabilities")) session_fs_set_provider_conventions = SessionFSSetProviderConventions(obj.get("SessionFsSetProviderConventions")) session_fs_set_provider_request = SessionFSSetProviderRequest.from_dict(obj.get("SessionFsSetProviderRequest")) session_fs_set_provider_result = SessionFSSetProviderResult.from_dict(obj.get("SessionFsSetProviderResult")) session_fs_sqlite_exists_request = SessionFSSqliteExistsRequest.from_dict(obj.get("SessionFsSqliteExistsRequest")) session_fs_sqlite_exists_result = SessionFSSqliteExistsResult.from_dict(obj.get("SessionFsSqliteExistsResult")) session_fs_sqlite_query_request = SessionFSSqliteQueryRequest.from_dict(obj.get("SessionFsSqliteQueryRequest")) session_fs_sqlite_query_result = SessionFSSqliteQueryResult.from_dict(obj.get("SessionFsSqliteQueryResult")) session_fs_sqlite_query_type = SessionFSSqliteQueryType(obj.get("SessionFsSqliteQueryType")) session_fs_stat_request = SessionFSStatRequest.from_dict(obj.get("SessionFsStatRequest")) session_fs_stat_result = SessionFSStatResult.from_dict(obj.get("SessionFsStatResult")) session_fs_write_file_request = SessionFSWriteFileRequest.from_dict(obj.get("SessionFsWriteFileRequest")) session_installed_plugin = SessionInstalledPlugin.from_dict(obj.get("SessionInstalledPlugin")) session_installed_plugin_source = from_union([SessionInstalledPluginSource.from_dict, from_str], obj.get("SessionInstalledPluginSource")) session_installed_plugin_source_git_hub = SessionInstalledPluginSourceGitHub.from_dict(obj.get("SessionInstalledPluginSourceGitHub")) session_installed_plugin_source_local = SessionInstalledPluginSourceLocal.from_dict(obj.get("SessionInstalledPluginSourceLocal")) session_installed_plugin_source_url = SessionInstalledPluginSourceURL.from_dict(obj.get("SessionInstalledPluginSourceUrl")) session_list = SessionList.from_dict(obj.get("SessionList")) session_list_entry = _load_SessionListEntry(obj.get("SessionListEntry")) session_list_filter = SessionListFilter.from_dict(obj.get("SessionListFilter")) session_load_deferred_repo_hooks_result = SessionLoadDeferredRepoHooksResult.from_dict(obj.get("SessionLoadDeferredRepoHooksResult")) session_log_level = SessionLogLevel(obj.get("SessionLogLevel")) session_mcp_apps_call_tool_result = from_dict(lambda x: x, obj.get("SessionMcpAppsCallToolResult")) session_metadata_snapshot = SessionMetadataSnapshot.from_dict(obj.get("SessionMetadataSnapshot")) session_mode = SessionMode(obj.get("SessionMode")) session_model_list = SessionModelList.from_dict(obj.get("SessionModelList")) session_open_options = SessionOpenOptions.from_dict(obj.get("SessionOpenOptions")) session_open_options_additional_content_exclusion_policy = SessionOpenOptionsAdditionalContentExclusionPolicy.from_dict(obj.get("SessionOpenOptionsAdditionalContentExclusionPolicy")) session_open_options_additional_content_exclusion_policy_rule = SessionOpenOptionsAdditionalContentExclusionPolicyRule.from_dict(obj.get("SessionOpenOptionsAdditionalContentExclusionPolicyRule")) session_open_options_additional_content_exclusion_policy_rule_source = SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource")) session_open_options_additional_content_exclusion_policy_scope = AdditionalContentExclusionPolicyScope(obj.get("SessionOpenOptionsAdditionalContentExclusionPolicyScope")) session_open_options_env_value_mode = MCPSetEnvValueModeDetails(obj.get("SessionOpenOptionsEnvValueMode")) session_open_options_reasoning_summary = ReasoningSummary(obj.get("SessionOpenOptionsReasoningSummary")) session_open_params = _load_SessionOpenParams(obj.get("SessionOpenParams")) session_open_result = SessionOpenResult.from_dict(obj.get("SessionOpenResult")) session_prune_result = SessionPruneResult.from_dict(obj.get("SessionPruneResult")) sessions_bulk_delete_request = SessionsBulkDeleteRequest.from_dict(obj.get("SessionsBulkDeleteRequest")) sessions_check_in_use_request = SessionsCheckInUseRequest.from_dict(obj.get("SessionsCheckInUseRequest")) sessions_check_in_use_result = SessionsCheckInUseResult.from_dict(obj.get("SessionsCheckInUseResult")) sessions_close_request = SessionsCloseRequest.from_dict(obj.get("SessionsCloseRequest")) sessions_close_result = SessionsCloseResult.from_dict(obj.get("SessionsCloseResult")) sessions_enrich_metadata_request = SessionsEnrichMetadataRequest.from_dict(obj.get("SessionsEnrichMetadataRequest")) session_set_credentials_params = SessionSetCredentialsParams.from_dict(obj.get("SessionSetCredentialsParams")) session_set_credentials_result = SessionSetCredentialsResult.from_dict(obj.get("SessionSetCredentialsResult")) sessions_find_by_prefix_request = SessionsFindByPrefixRequest.from_dict(obj.get("SessionsFindByPrefixRequest")) sessions_find_by_prefix_result = SessionsFindByPrefixResult.from_dict(obj.get("SessionsFindByPrefixResult")) sessions_find_by_task_id_request = SessionsFindByTaskIDRequest.from_dict(obj.get("SessionsFindByTaskIDRequest")) sessions_find_by_task_id_result = SessionsFindByTaskIDResult.from_dict(obj.get("SessionsFindByTaskIDResult")) sessions_fork_request = SessionsForkRequest.from_dict(obj.get("SessionsForkRequest")) sessions_fork_result = SessionsForkResult.from_dict(obj.get("SessionsForkResult")) sessions_get_board_entry_count_request = SessionsGetBoardEntryCountRequest.from_dict(obj.get("SessionsGetBoardEntryCountRequest")) sessions_get_board_entry_count_result = SessionsGetBoardEntryCountResult.from_dict(obj.get("SessionsGetBoardEntryCountResult")) sessions_get_event_file_path_request = SessionsGetEventFilePathRequest.from_dict(obj.get("SessionsGetEventFilePathRequest")) sessions_get_event_file_path_result = SessionsGetEventFilePathResult.from_dict(obj.get("SessionsGetEventFilePathResult")) sessions_get_last_for_context_request = SessionsGetLastForContextRequest.from_dict(obj.get("SessionsGetLastForContextRequest")) sessions_get_last_for_context_result = SessionsGetLastForContextResult.from_dict(obj.get("SessionsGetLastForContextResult")) sessions_get_persisted_remote_steerable_request = SessionsGetPersistedRemoteSteerableRequest.from_dict(obj.get("SessionsGetPersistedRemoteSteerableRequest")) sessions_get_persisted_remote_steerable_result = SessionsGetPersistedRemoteSteerableResult.from_dict(obj.get("SessionsGetPersistedRemoteSteerableResult")) session_sizes = SessionSizes.from_dict(obj.get("SessionSizes")) sessions_list_request = SessionsListRequest.from_dict(obj.get("SessionsListRequest")) sessions_load_deferred_repo_hooks_request = SessionsLoadDeferredRepoHooksRequest.from_dict(obj.get("SessionsLoadDeferredRepoHooksRequest")) sessions_open_attach = SessionsOpenAttach.from_dict(obj.get("SessionsOpenAttach")) sessions_open_cloud = SessionsOpenCloud.from_dict(obj.get("SessionsOpenCloud")) sessions_open_create = SessionsOpenCreate.from_dict(obj.get("SessionsOpenCreate")) sessions_open_handoff = SessionsOpenHandoff.from_dict(obj.get("SessionsOpenHandoff")) sessions_open_handoff_task_type = TaskType(obj.get("SessionsOpenHandoffTaskType")) sessions_open_progress = SessionsOpenProgress.from_dict(obj.get("SessionsOpenProgress")) sessions_open_progress_status = SessionsOpenProgressStatus(obj.get("SessionsOpenProgressStatus")) sessions_open_progress_step = SessionsOpenProgressStep(obj.get("SessionsOpenProgressStep")) sessions_open_remote = SessionsOpenRemote.from_dict(obj.get("SessionsOpenRemote")) sessions_open_resume = SessionsOpenResume.from_dict(obj.get("SessionsOpenResume")) sessions_open_resume_last = SessionsOpenResumeLast.from_dict(obj.get("SessionsOpenResumeLast")) sessions_open_status = SessionsOpenStatus(obj.get("SessionsOpenStatus")) session_source = SessionSource(obj.get("SessionSource")) sessions_poll_spawned_sessions_event = SessionsPollSpawnedSessionsEvent.from_dict(obj.get("SessionsPollSpawnedSessionsEvent")) sessions_poll_spawned_sessions_request = SessionsPollSpawnedSessionsRequest.from_dict(obj.get("SessionsPollSpawnedSessionsRequest")) sessions_prune_old_request = SessionsPruneOldRequest.from_dict(obj.get("SessionsPruneOldRequest")) sessions_register_extension_tools_on_session_options = SessionsRegisterExtensionToolsOnSessionOptions.from_dict(obj.get("SessionsRegisterExtensionToolsOnSessionOptions")) sessions_release_lock_request = SessionsReleaseLockRequest.from_dict(obj.get("SessionsReleaseLockRequest")) sessions_release_lock_result = SessionsReleaseLockResult.from_dict(obj.get("SessionsReleaseLockResult")) sessions_reload_plugin_hooks_request = SessionsReloadPluginHooksRequest.from_dict(obj.get("SessionsReloadPluginHooksRequest")) sessions_reload_plugin_hooks_result = SessionsReloadPluginHooksResult.from_dict(obj.get("SessionsReloadPluginHooksResult")) sessions_save_request = SessionsSaveRequest.from_dict(obj.get("SessionsSaveRequest")) sessions_save_result = SessionsSaveResult.from_dict(obj.get("SessionsSaveResult")) sessions_set_additional_plugins_request = SessionsSetAdditionalPluginsRequest.from_dict(obj.get("SessionsSetAdditionalPluginsRequest")) sessions_set_additional_plugins_result = SessionsSetAdditionalPluginsResult.from_dict(obj.get("SessionsSetAdditionalPluginsResult")) sessions_set_remote_control_steering_request = SessionsSetRemoteControlSteeringRequest.from_dict(obj.get("SessionsSetRemoteControlSteeringRequest")) sessions_start_remote_control_request = SessionsStartRemoteControlRequest.from_dict(obj.get("SessionsStartRemoteControlRequest")) sessions_stop_remote_control_request = SessionsStopRemoteControlRequest.from_dict(obj.get("SessionsStopRemoteControlRequest")) sessions_transfer_remote_control_request = SessionsTransferRemoteControlRequest.from_dict(obj.get("SessionsTransferRemoteControlRequest")) session_telemetry_engagement = SessionTelemetryEngagement.from_dict(obj.get("SessionTelemetryEngagement")) session_update_options_params = SessionUpdateOptionsParams.from_dict(obj.get("SessionUpdateOptionsParams")) session_update_options_result = SessionUpdateOptionsResult.from_dict(obj.get("SessionUpdateOptionsResult")) session_visibility_status = SessionVisibilityStatus(obj.get("SessionVisibilityStatus")) session_working_directory_context = SessionWorkingDirectoryContext.from_dict(obj.get("SessionWorkingDirectoryContext")) session_working_directory_context_host_type = HostType(obj.get("SessionWorkingDirectoryContextHostType")) shell_cancel_user_requested_request = ShellCancelUserRequestedRequest.from_dict(obj.get("ShellCancelUserRequestedRequest")) shell_exec_request = ShellExecRequest.from_dict(obj.get("ShellExecRequest")) shell_exec_result = ShellExecResult.from_dict(obj.get("ShellExecResult")) shell_execute_user_requested_request = ShellExecuteUserRequestedRequest.from_dict(obj.get("ShellExecuteUserRequestedRequest")) shell_kill_request = ShellKillRequest.from_dict(obj.get("ShellKillRequest")) shell_kill_result = ShellKillResult.from_dict(obj.get("ShellKillResult")) shell_kill_signal = ShellKillSignal(obj.get("ShellKillSignal")) shutdown_request = ShutdownRequest.from_dict(obj.get("ShutdownRequest")) skill = Skill.from_dict(obj.get("Skill")) skill_discovery_path = SkillDiscoveryPath.from_dict(obj.get("SkillDiscoveryPath")) skill_discovery_path_list = SkillDiscoveryPathList.from_dict(obj.get("SkillDiscoveryPathList")) skill_discovery_scope = SkillDiscoveryScope(obj.get("SkillDiscoveryScope")) skill_list = SkillList.from_dict(obj.get("SkillList")) skills_config_set_disabled_skills_request = SkillsConfigSetDisabledSkillsRequest.from_dict(obj.get("SkillsConfigSetDisabledSkillsRequest")) skills_disable_request = SkillsDisableRequest.from_dict(obj.get("SkillsDisableRequest")) skills_discover_request = SkillsDiscoverRequest.from_dict(obj.get("SkillsDiscoverRequest")) skills_enable_request = SkillsEnableRequest.from_dict(obj.get("SkillsEnableRequest")) skills_get_discovery_paths_request = SkillsGetDiscoveryPathsRequest.from_dict(obj.get("SkillsGetDiscoveryPathsRequest")) skills_get_invoked_result = SkillsGetInvokedResult.from_dict(obj.get("SkillsGetInvokedResult")) skills_invoked_skill = SkillsInvokedSkill.from_dict(obj.get("SkillsInvokedSkill")) skills_load_diagnostics = SkillsLoadDiagnostics.from_dict(obj.get("SkillsLoadDiagnostics")) slash_command_agent_prompt_result = SlashCommandAgentPromptResult.from_dict(obj.get("SlashCommandAgentPromptResult")) slash_command_completed_result = SlashCommandCompletedResult.from_dict(obj.get("SlashCommandCompletedResult")) slash_command_info = SlashCommandInfo.from_dict(obj.get("SlashCommandInfo")) slash_command_input = SlashCommandInput.from_dict(obj.get("SlashCommandInput")) slash_command_input_completion = SlashCommandInputCompletion(obj.get("SlashCommandInputCompletion")) slash_command_invocation_result = _load_SlashCommandInvocationResult(obj.get("SlashCommandInvocationResult")) slash_command_kind = SlashCommandKind(obj.get("SlashCommandKind")) slash_command_select_subcommand_option = SlashCommandSelectSubcommandOption.from_dict(obj.get("SlashCommandSelectSubcommandOption")) slash_command_select_subcommand_result = SlashCommandSelectSubcommandResult.from_dict(obj.get("SlashCommandSelectSubcommandResult")) slash_command_text_result = SlashCommandTextResult.from_dict(obj.get("SlashCommandTextResult")) subagent_settings_entry = SubagentSettingsEntry.from_dict(obj.get("SubagentSettingsEntry")) subagent_settings_entry_context_tier = SubagentSettingsEntryContextTier(obj.get("SubagentSettingsEntryContextTier")) task_agent_info = TaskAgentInfo.from_dict(obj.get("TaskAgentInfo")) task_agent_progress = TaskAgentProgress.from_dict(obj.get("TaskAgentProgress")) task_execution_mode = TaskExecutionMode(obj.get("TaskExecutionMode")) task_info = _load_TaskInfo(obj.get("TaskInfo")) task_list = TaskList.from_dict(obj.get("TaskList")) task_progress_line = TaskProgressLine.from_dict(obj.get("TaskProgressLine")) tasks_cancel_request = TasksCancelRequest.from_dict(obj.get("TasksCancelRequest")) tasks_cancel_result = TasksCancelResult.from_dict(obj.get("TasksCancelResult")) tasks_get_current_promotable_result = TasksGetCurrentPromotableResult.from_dict(obj.get("TasksGetCurrentPromotableResult")) tasks_get_progress_request = TasksGetProgressRequest.from_dict(obj.get("TasksGetProgressRequest")) tasks_get_progress_result = TasksGetProgressResult.from_dict(obj.get("TasksGetProgressResult")) task_shell_info = TaskShellInfo.from_dict(obj.get("TaskShellInfo")) task_shell_info_attachment_mode = TaskShellInfoAttachmentMode(obj.get("TaskShellInfoAttachmentMode")) task_shell_progress = TaskShellProgress.from_dict(obj.get("TaskShellProgress")) tasks_promote_current_to_background_result = TasksPromoteCurrentToBackgroundResult.from_dict(obj.get("TasksPromoteCurrentToBackgroundResult")) tasks_promote_to_background_request = TasksPromoteToBackgroundRequest.from_dict(obj.get("TasksPromoteToBackgroundRequest")) tasks_promote_to_background_result = TasksPromoteToBackgroundResult.from_dict(obj.get("TasksPromoteToBackgroundResult")) tasks_refresh_result = TasksRefreshResult.from_dict(obj.get("TasksRefreshResult")) tasks_remove_request = TasksRemoveRequest.from_dict(obj.get("TasksRemoveRequest")) tasks_remove_result = TasksRemoveResult.from_dict(obj.get("TasksRemoveResult")) tasks_send_message_request = TasksSendMessageRequest.from_dict(obj.get("TasksSendMessageRequest")) tasks_send_message_result = TasksSendMessageResult.from_dict(obj.get("TasksSendMessageResult")) tasks_start_agent_request = TasksStartAgentRequest.from_dict(obj.get("TasksStartAgentRequest")) tasks_start_agent_result = TasksStartAgentResult.from_dict(obj.get("TasksStartAgentResult")) task_status = TaskStatus(obj.get("TaskStatus")) tasks_wait_for_pending_result = TasksWaitForPendingResult.from_dict(obj.get("TasksWaitForPendingResult")) telemetry_set_feature_overrides_request = TelemetrySetFeatureOverridesRequest.from_dict(obj.get("TelemetrySetFeatureOverridesRequest")) token_auth_info = TokenAuthInfo.from_dict(obj.get("TokenAuthInfo")) tool = Tool.from_dict(obj.get("Tool")) tool_list = ToolList.from_dict(obj.get("ToolList")) tools_get_current_metadata_result = ToolsGetCurrentMetadataResult.from_dict(obj.get("ToolsGetCurrentMetadataResult")) tools_initialize_and_validate_result = ToolsInitializeAndValidateResult.from_dict(obj.get("ToolsInitializeAndValidateResult")) tools_list_request = ToolsListRequest.from_dict(obj.get("ToolsListRequest")) tools_update_subagent_settings_result = ToolsUpdateSubagentSettingsResult.from_dict(obj.get("ToolsUpdateSubagentSettingsResult")) ui_auto_mode_switch_response = UIAutoModeSwitchResponse(obj.get("UIAutoModeSwitchResponse")) ui_elicitation_array_any_of_field = UIElicitationArrayAnyOfField.from_dict(obj.get("UIElicitationArrayAnyOfField")) ui_elicitation_array_any_of_field_items = UIElicitationArrayAnyOfFieldItems.from_dict(obj.get("UIElicitationArrayAnyOfFieldItems")) ui_elicitation_array_any_of_field_items_any_of = UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict(obj.get("UIElicitationArrayAnyOfFieldItemsAnyOf")) ui_elicitation_array_enum_field = UIElicitationArrayEnumField.from_dict(obj.get("UIElicitationArrayEnumField")) ui_elicitation_array_enum_field_items = UIElicitationArrayEnumFieldItems.from_dict(obj.get("UIElicitationArrayEnumFieldItems")) ui_elicitation_field_value = from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], obj.get("UIElicitationFieldValue")) ui_elicitation_request = UIElicitationRequest.from_dict(obj.get("UIElicitationRequest")) ui_elicitation_response = UIElicitationResponse.from_dict(obj.get("UIElicitationResponse")) ui_elicitation_response_action = UIElicitationResponseAction(obj.get("UIElicitationResponseAction")) ui_elicitation_response_content = from_dict(lambda x: from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], x), obj.get("UIElicitationResponseContent")) ui_elicitation_result = UIElicitationResult.from_dict(obj.get("UIElicitationResult")) ui_elicitation_schema = UIElicitationSchema.from_dict(obj.get("UIElicitationSchema")) ui_elicitation_schema_property = UIElicitationSchemaProperty.from_dict(obj.get("UIElicitationSchemaProperty")) ui_elicitation_schema_property_boolean = UIElicitationSchemaPropertyBoolean.from_dict(obj.get("UIElicitationSchemaPropertyBoolean")) ui_elicitation_schema_property_number = UIElicitationSchemaPropertyNumber.from_dict(obj.get("UIElicitationSchemaPropertyNumber")) ui_elicitation_schema_property_number_type = UIElicitationSchemaPropertyNumberType(obj.get("UIElicitationSchemaPropertyNumberType")) ui_elicitation_schema_property_string = UIElicitationSchemaPropertyString.from_dict(obj.get("UIElicitationSchemaPropertyString")) ui_elicitation_schema_property_string_format = UIElicitationSchemaPropertyStringFormat(obj.get("UIElicitationSchemaPropertyStringFormat")) ui_elicitation_string_enum_field = UIElicitationStringEnumField.from_dict(obj.get("UIElicitationStringEnumField")) ui_elicitation_string_one_of_field = UIElicitationStringOneOfField.from_dict(obj.get("UIElicitationStringOneOfField")) ui_elicitation_string_one_of_field_one_of = UIElicitationStringOneOfFieldOneOf.from_dict(obj.get("UIElicitationStringOneOfFieldOneOf")) ui_ephemeral_query_request = UIEphemeralQueryRequest.from_dict(obj.get("UIEphemeralQueryRequest")) ui_ephemeral_query_result = UIEphemeralQueryResult.from_dict(obj.get("UIEphemeralQueryResult")) ui_exit_plan_mode_action = UIExitPlanModeAction(obj.get("UIExitPlanModeAction")) ui_exit_plan_mode_response = UIExitPlanModeResponse.from_dict(obj.get("UIExitPlanModeResponse")) ui_handle_pending_auto_mode_switch_request = UIHandlePendingAutoModeSwitchRequest.from_dict(obj.get("UIHandlePendingAutoModeSwitchRequest")) ui_handle_pending_elicitation_request = UIHandlePendingElicitationRequest.from_dict(obj.get("UIHandlePendingElicitationRequest")) ui_handle_pending_exit_plan_mode_request = UIHandlePendingExitPlanModeRequest.from_dict(obj.get("UIHandlePendingExitPlanModeRequest")) ui_handle_pending_result = UIHandlePendingResult.from_dict(obj.get("UIHandlePendingResult")) ui_handle_pending_sampling_request = UIHandlePendingSamplingRequest.from_dict(obj.get("UIHandlePendingSamplingRequest")) ui_handle_pending_sampling_response = from_dict(lambda x: x, obj.get("UIHandlePendingSamplingResponse")) ui_handle_pending_session_limits_exhausted_request = UIHandlePendingSessionLimitsExhaustedRequest.from_dict(obj.get("UIHandlePendingSessionLimitsExhaustedRequest")) ui_handle_pending_user_input_request = UIHandlePendingUserInputRequest.from_dict(obj.get("UIHandlePendingUserInputRequest")) ui_register_direct_auto_mode_switch_handler_result = UIRegisterDirectAutoModeSwitchHandlerResult.from_dict(obj.get("UIRegisterDirectAutoModeSwitchHandlerResult")) ui_session_limits_exhausted_response = UISessionLimitsExhaustedResponse.from_dict(obj.get("UISessionLimitsExhaustedResponse")) ui_session_limits_exhausted_response_action = UISessionLimitsExhaustedResponseAction(obj.get("UISessionLimitsExhaustedResponseAction")) ui_unregister_direct_auto_mode_switch_handler_request = UIUnregisterDirectAutoModeSwitchHandlerRequest.from_dict(obj.get("UIUnregisterDirectAutoModeSwitchHandlerRequest")) ui_unregister_direct_auto_mode_switch_handler_result = UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict(obj.get("UIUnregisterDirectAutoModeSwitchHandlerResult")) ui_user_input_response = UIUserInputResponse.from_dict(obj.get("UIUserInputResponse")) update_subagent_settings_request = UpdateSubagentSettingsRequest.from_dict(obj.get("UpdateSubagentSettingsRequest")) usage_get_metrics_result = UsageGetMetricsResult.from_dict(obj.get("UsageGetMetricsResult")) usage_metrics_code_changes = UsageMetricsCodeChanges.from_dict(obj.get("UsageMetricsCodeChanges")) usage_metrics_model_metric = UsageMetricsModelMetric.from_dict(obj.get("UsageMetricsModelMetric")) usage_metrics_model_metric_requests = UsageMetricsModelMetricRequests.from_dict(obj.get("UsageMetricsModelMetricRequests")) usage_metrics_model_metric_token_detail = UsageMetricsModelMetricTokenDetail.from_dict(obj.get("UsageMetricsModelMetricTokenDetail")) usage_metrics_model_metric_usage = UsageMetricsModelMetricUsage.from_dict(obj.get("UsageMetricsModelMetricUsage")) usage_metrics_token_detail = UsageMetricsTokenDetail.from_dict(obj.get("UsageMetricsTokenDetail")) user_auth_info = UserAuthInfo.from_dict(obj.get("UserAuthInfo")) user_requested_shell_command_result = UserRequestedShellCommandResult.from_dict(obj.get("UserRequestedShellCommandResult")) user_setting_metadata = UserSettingMetadata.from_dict(obj.get("UserSettingMetadata")) user_settings_get_result = UserSettingsGetResult.from_dict(obj.get("UserSettingsGetResult")) user_settings_set_request = UserSettingsSetRequest.from_dict(obj.get("UserSettingsSetRequest")) user_settings_set_result = UserSettingsSetResult.from_dict(obj.get("UserSettingsSetResult")) visibility_get_result = VisibilityGetResult.from_dict(obj.get("VisibilityGetResult")) visibility_set_request = VisibilitySetRequest.from_dict(obj.get("VisibilitySetRequest")) visibility_set_result = VisibilitySetResult.from_dict(obj.get("VisibilitySetResult")) workspace_diff_file_change = WorkspaceDiffFileChange.from_dict(obj.get("WorkspaceDiffFileChange")) workspace_diff_file_change_type = WorkspaceDiffFileChangeType(obj.get("WorkspaceDiffFileChangeType")) workspace_diff_mode = WorkspaceDiffMode(obj.get("WorkspaceDiffMode")) workspace_diff_result = WorkspaceDiffResult.from_dict(obj.get("WorkspaceDiffResult")) workspaces_checkpoints = WorkspacesCheckpoints.from_dict(obj.get("WorkspacesCheckpoints")) workspaces_create_file_request = WorkspacesCreateFileRequest.from_dict(obj.get("WorkspacesCreateFileRequest")) workspaces_diff_request = WorkspacesDiffRequest.from_dict(obj.get("WorkspacesDiffRequest")) workspaces_get_workspace_result = WorkspacesGetWorkspaceResult.from_dict(obj.get("WorkspacesGetWorkspaceResult")) workspaces_list_checkpoints_result = WorkspacesListCheckpointsResult.from_dict(obj.get("WorkspacesListCheckpointsResult")) workspaces_list_files_result = WorkspacesListFilesResult.from_dict(obj.get("WorkspacesListFilesResult")) workspaces_read_checkpoint_request = WorkspacesReadCheckpointRequest.from_dict(obj.get("WorkspacesReadCheckpointRequest")) workspaces_read_checkpoint_result = WorkspacesReadCheckpointResult.from_dict(obj.get("WorkspacesReadCheckpointResult")) workspaces_read_file_request = WorkspacesReadFileRequest.from_dict(obj.get("WorkspacesReadFileRequest")) workspaces_read_file_result = WorkspacesReadFileResult.from_dict(obj.get("WorkspacesReadFileResult")) workspaces_save_large_paste_request = WorkspacesSaveLargePasteRequest.from_dict(obj.get("WorkspacesSaveLargePasteRequest")) workspaces_save_large_paste_result = WorkspacesSaveLargePasteResult.from_dict(obj.get("WorkspacesSaveLargePasteResult")) workspace_summary_host_type = HostType(obj.get("WorkspaceSummaryHostType")) workspaces_workspace_details_host_type = HostType(obj.get("WorkspacesWorkspaceDetailsHostType")) session_context_info = from_union([SessionContextInfo.from_dict, from_none], obj.get("SessionContextInfo")) subagent_settings = from_union([SubagentSettings.from_dict, from_none], obj.get("SubagentSettings")) task_progress = from_union([TaskProgress.from_dict, from_none], obj.get("TaskProgress")) workspace_summary = from_union([WorkspaceSummary.from_dict, from_none], obj.get("WorkspaceSummary")) return RPC(abort_request, abort_result, account_all_users, account_get_all_users_result, account_get_current_auth_result, account_get_quota_request, account_get_quota_result, account_login_request, account_login_result, account_logout_request, account_logout_result, account_quota_snapshot, adaptive_thinking_support, agent_discovery_path, agent_discovery_path_list, agent_discovery_path_scope, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_registry_live_target_entry, agent_registry_live_target_entry_attention_kind, agent_registry_live_target_entry_kind, agent_registry_live_target_entry_last_terminal_event, agent_registry_live_target_entry_status, agent_registry_log_capture, agent_registry_log_capture_open_error_reason, agent_registry_spawn_error, agent_registry_spawn_permission_mode, agent_registry_spawn_registry_timeout, agent_registry_spawn_request, agent_registry_spawn_result, agent_registry_spawn_spawned, agent_registry_spawn_validation_error, agent_registry_spawn_validation_error_field, agent_registry_spawn_validation_error_reason, agent_reload_result, agents_discover_request, agent_select_request, agent_select_result, agents_get_discovery_paths_request, allow_all_permission_set_result, allow_all_permission_state, api_key_auth_info, auth_info, auth_info_type, cancel_user_requested_shell_command_result, canvas_action, canvas_action_invoke_request, canvas_action_invoke_result, canvas_close_request, canvas_host_context, canvas_host_context_capabilities, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, canvas_provider_close_request, canvas_provider_invoke_action_request, canvas_provider_open_request, canvas_provider_open_result, canvas_session_context, capi_session_options, command_list, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, completions_get_trigger_characters_result, completions_request_request, completions_request_result, configure_session_extensions_params, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_filter_mode, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, current_tool_metadata, discovered_canvas, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_result, execute_command_params, execute_command_result, extension, extension_context_push_input, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_shell_exit, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, git_hub_telemetry_client_info, git_hub_telemetry_event, git_hub_telemetry_notification, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_compact_context_window, history_compact_request, history_compact_result, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, installed_plugin, installed_plugin_info, installed_plugin_source, installed_plugin_source_git_hub, installed_plugin_source_local, installed_plugin_source_url, instruction_discovery_path, instruction_discovery_path_kind, instruction_discovery_path_list, instruction_discovery_path_location, instructions_discover_request, instructions_get_discovery_paths_request, instructions_get_sources_result, instruction_source, instruction_source_location, instruction_source_type, llm_inference_headers, llm_inference_http_request_chunk_request, llm_inference_http_request_chunk_result, llm_inference_http_request_start_request, llm_inference_http_request_start_result, llm_inference_http_request_start_transport, llm_inference_http_response_chunk_error, llm_inference_http_response_chunk_request, llm_inference_http_response_chunk_result, llm_inference_http_response_start_request, llm_inference_http_response_start_result, llm_inference_set_provider_result, local_session_metadata_value, log_request, log_result, lsp_initialize_request, marketplace_add_result, marketplace_browse_result, marketplace_info, marketplace_list_result, marketplace_plugin_info, marketplace_refresh_entry, marketplace_refresh_result, marketplace_remove_result, mcp_allowed_server, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_configure_git_hub_request, mcp_configure_git_hub_result, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_filtered_server, mcp_headers_handle_pending_headers_refresh_request, mcp_headers_handle_pending_headers_refresh_request_request, mcp_headers_handle_pending_headers_refresh_request_result, mcp_host_state, mcp_is_server_running_request, mcp_is_server_running_result, mcp_list_tools_request, mcp_list_tools_result, mcp_oauth_handle_pending_request, mcp_oauth_handle_pending_result, mcp_oauth_login_grant_type, mcp_oauth_login_request, mcp_oauth_login_result, mcp_oauth_pending_request_response, mcp_oauth_respond_request, mcp_oauth_respond_result, mcp_register_external_client_request, mcp_reload_with_config_request, mcp_remove_git_hub_result, mcp_restart_server_request, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_server, mcp_server_auth_config, mcp_server_auth_config_redirect_port, mcp_server_config, mcp_server_config_defer_tools, mcp_server_config_http, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_type, mcp_server_config_stdio, mcp_server_failure_info, mcp_server_list, mcp_server_needs_auth_info, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, mcp_start_server_request, mcp_start_servers_result, mcp_stop_server_request, mcp_tools, mcp_unregister_external_client_request, memory_configuration, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_billing, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_list_request, model_picker_category, model_picker_price_category, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, named_provider_config, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, open_canvas_instance, options_update_additional_content_exclusion_policy, options_update_additional_content_exclusion_policy_rule, options_update_additional_content_exclusion_policy_rule_source, options_update_additional_content_exclusion_policy_scope, options_update_context_tier, options_update_env_value_mode, options_update_reasoning_summary, options_update_tool_filter_precedence, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_get_allow_all_request, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_allow_all_request, permissions_set_allow_all_source, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_read_sql_todos_result, plan_read_sql_todos_with_dependencies_result, plan_sql_todo_dependency, plan_sql_todos_row, plan_update_request, plugin, plugin_install_result, plugin_list, plugin_list_result, plugins_disable_request, plugins_enable_request, plugins_install_request, plugins_marketplaces_add_request, plugins_marketplaces_browse_request, plugins_marketplaces_refresh_request, plugins_marketplaces_remove_request, plugins_reload_request, plugins_uninstall_request, plugins_update_request, plugin_update_all_entry, plugin_update_all_result, plugin_update_result, poll_spawned_sessions_result, provider_add_request, provider_add_result, provider_config, provider_config_azure, provider_config_transport, provider_config_type, provider_config_wire_api, provider_endpoint, provider_endpoint_transport, provider_endpoint_type, provider_endpoint_wire_api, provider_get_endpoint_request, provider_model_config, provider_session_token, provider_token_acquire_request, provider_token_acquire_result, push_attachment, push_attachment_blob, push_attachment_directory, push_attachment_file, push_attachment_file_line_range, push_attachment_git_hub_actions_job, push_attachment_git_hub_commit, push_attachment_git_hub_file, push_attachment_git_hub_file_diff, push_attachment_git_hub_file_diff_side, push_attachment_git_hub_reference, push_attachment_git_hub_reference_type, push_attachment_git_hub_release, push_attachment_git_hub_repository, push_attachment_git_hub_snippet, push_attachment_git_hub_tree_comparison, push_attachment_git_hub_tree_comparison_side, push_attachment_git_hub_url, push_attachment_selection, push_attachment_selection_details, push_attachment_selection_details_end, push_attachment_selection_details_start, push_git_hub_repo_ref, queued_command_handled, queued_command_not_handled, queued_command_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_most_recent_result, register_event_interest_params, register_event_interest_result, register_extension_tools_params, register_extension_tools_result, release_event_interest_params, remote_control_config, remote_control_config_existing_mc_session, remote_control_status, remote_control_status_active, remote_control_status_connecting, remote_control_status_error, remote_control_status_off, remote_control_status_result, remote_control_stop_result, remote_control_transfer_result, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_metadata_repository, remote_session_metadata_task_type, remote_session_metadata_value, remote_session_mode, remote_session_repository, sandbox_config, sandbox_config_user_policy, sandbox_config_user_policy_experimental, sandbox_config_user_policy_experimental_seatbelt, sandbox_config_user_policy_filesystem, sandbox_config_user_policy_network, sandbox_config_user_policy_seatbelt, schedule_entry, schedule_list, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachments_to_message_params, send_mode, send_request, send_result, server_agent_list, server_instruction_source_list, server_skill, server_skill_list, session_activity, session_auth_status, session_bulk_delete_result, session_capability, session_completion_item, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_git_hub, session_installed_plugin_source_local, session_installed_plugin_source_url, session_list, session_list_entry, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_mcp_apps_call_tool_result, session_metadata_snapshot, session_mode, session_model_list, session_open_options, session_open_options_additional_content_exclusion_policy, session_open_options_additional_content_exclusion_policy_rule, session_open_options_additional_content_exclusion_policy_rule_source, session_open_options_additional_content_exclusion_policy_scope, session_open_options_env_value_mode, session_open_options_reasoning_summary, session_open_params, session_open_result, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_board_entry_count_request, sessions_get_board_entry_count_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_open_attach, sessions_open_cloud, sessions_open_create, sessions_open_handoff, sessions_open_handoff_task_type, sessions_open_progress, sessions_open_progress_status, sessions_open_progress_step, sessions_open_remote, sessions_open_resume, sessions_open_resume_last, sessions_open_status, session_source, sessions_poll_spawned_sessions_event, sessions_poll_spawned_sessions_request, sessions_prune_old_request, sessions_register_extension_tools_on_session_options, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, sessions_set_remote_control_steering_request, sessions_start_remote_control_request, sessions_stop_remote_control_request, sessions_transfer_remote_control_request, session_telemetry_engagement, session_update_options_params, session_update_options_result, session_visibility_status, session_working_directory_context, session_working_directory_context_host_type, shell_cancel_user_requested_request, shell_exec_request, shell_exec_result, shell_execute_user_requested_request, shell_kill_request, shell_kill_result, shell_kill_signal, shutdown_request, skill, skill_discovery_path, skill_discovery_path_list, skill_discovery_scope, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_discovery_paths_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_text_result, subagent_settings_entry, subagent_settings_entry_context_tier, task_agent_info, task_agent_progress, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tools_get_current_metadata_result, tools_initialize_and_validate_result, tools_list_request, tools_update_subagent_settings_result, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_ephemeral_query_request, ui_ephemeral_query_result, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_session_limits_exhausted_request, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_session_limits_exhausted_response, ui_session_limits_exhausted_response_action, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, update_subagent_settings_request, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, user_requested_shell_command_result, user_setting_metadata, user_settings_get_result, user_settings_set_request, user_settings_set_result, visibility_get_result, visibility_set_request, visibility_set_result, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_diff_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspace_summary_host_type, workspaces_workspace_details_host_type, session_context_info, subagent_settings, task_progress, workspace_summary) def to_dict(self) -> dict: result: dict = {} result["AbortRequest"] = to_class(AbortRequest, self.abort_request) result["AbortResult"] = to_class(AbortResult, self.abort_result) result["AccountAllUsers"] = to_class(AccountAllUsers, self.account_all_users) result["AccountGetAllUsersResult"] = from_list(lambda x: to_class(AccountAllUsers, x), self.account_get_all_users_result) result["AccountGetCurrentAuthResult"] = to_class(AccountGetCurrentAuthResult, self.account_get_current_auth_result) result["AccountGetQuotaRequest"] = to_class(AccountGetQuotaRequest, self.account_get_quota_request) result["AccountGetQuotaResult"] = to_class(AccountGetQuotaResult, self.account_get_quota_result) result["AccountLoginRequest"] = to_class(AccountLoginRequest, self.account_login_request) result["AccountLoginResult"] = to_class(AccountLoginResult, self.account_login_result) result["AccountLogoutRequest"] = to_class(AccountLogoutRequest, self.account_logout_request) result["AccountLogoutResult"] = to_class(AccountLogoutResult, self.account_logout_result) result["AccountQuotaSnapshot"] = to_class(AccountQuotaSnapshot, self.account_quota_snapshot) result["AdaptiveThinkingSupport"] = to_enum(AdaptiveThinkingSupport, self.adaptive_thinking_support) result["AgentDiscoveryPath"] = to_class(AgentDiscoveryPath, self.agent_discovery_path) result["AgentDiscoveryPathList"] = to_class(AgentDiscoveryPathList, self.agent_discovery_path_list) result["AgentDiscoveryPathScope"] = to_enum(AgentDiscoveryPathScope, self.agent_discovery_path_scope) result["AgentGetCurrentResult"] = to_class(AgentGetCurrentResult, self.agent_get_current_result) result["AgentInfo"] = to_class(AgentInfo, self.agent_info) result["AgentInfoSource"] = to_enum(AgentInfoSource, self.agent_info_source) result["AgentList"] = to_class(AgentList, self.agent_list) result["AgentRegistryLiveTargetEntry"] = to_class(AgentRegistryLiveTargetEntry, self.agent_registry_live_target_entry) result["AgentRegistryLiveTargetEntryAttentionKind"] = to_enum(AgentRegistryLiveTargetEntryAttentionKind, self.agent_registry_live_target_entry_attention_kind) result["AgentRegistryLiveTargetEntryKind"] = to_enum(AgentRegistryLiveTargetEntryKind, self.agent_registry_live_target_entry_kind) result["AgentRegistryLiveTargetEntryLastTerminalEvent"] = to_enum(AgentRegistryLiveTargetEntryLastTerminalEvent, self.agent_registry_live_target_entry_last_terminal_event) result["AgentRegistryLiveTargetEntryStatus"] = to_enum(AgentRegistryLiveTargetEntryStatus, self.agent_registry_live_target_entry_status) result["AgentRegistryLogCapture"] = to_class(AgentRegistryLogCapture, self.agent_registry_log_capture) result["AgentRegistryLogCaptureOpenErrorReason"] = to_enum(AgentRegistryLogCaptureOpenErrorReason, self.agent_registry_log_capture_open_error_reason) result["AgentRegistrySpawnError"] = to_class(AgentRegistrySpawnError, self.agent_registry_spawn_error) result["AgentRegistrySpawnPermissionMode"] = to_enum(AgentRegistrySpawnPermissionMode, self.agent_registry_spawn_permission_mode) result["AgentRegistrySpawnRegistryTimeout"] = to_class(AgentRegistrySpawnRegistryTimeout, self.agent_registry_spawn_registry_timeout) result["AgentRegistrySpawnRequest"] = to_class(AgentRegistrySpawnRequest, self.agent_registry_spawn_request) result["AgentRegistrySpawnResult"] = (self.agent_registry_spawn_result).to_dict() result["AgentRegistrySpawnSpawned"] = to_class(AgentRegistrySpawnSpawned, self.agent_registry_spawn_spawned) result["AgentRegistrySpawnValidationError"] = to_class(AgentRegistrySpawnValidationError, self.agent_registry_spawn_validation_error) result["AgentRegistrySpawnValidationErrorField"] = to_enum(AgentRegistrySpawnValidationErrorField, self.agent_registry_spawn_validation_error_field) result["AgentRegistrySpawnValidationErrorReason"] = to_enum(AgentRegistrySpawnValidationErrorReason, self.agent_registry_spawn_validation_error_reason) result["AgentReloadResult"] = to_class(AgentReloadResult, self.agent_reload_result) result["AgentsDiscoverRequest"] = to_class(AgentsDiscoverRequest, self.agents_discover_request) result["AgentSelectRequest"] = to_class(AgentSelectRequest, self.agent_select_request) result["AgentSelectResult"] = to_class(AgentSelectResult, self.agent_select_result) result["AgentsGetDiscoveryPathsRequest"] = to_class(AgentsGetDiscoveryPathsRequest, self.agents_get_discovery_paths_request) result["AllowAllPermissionSetResult"] = to_class(AllowAllPermissionSetResult, self.allow_all_permission_set_result) result["AllowAllPermissionState"] = to_class(AllowAllPermissionState, self.allow_all_permission_state) result["ApiKeyAuthInfo"] = to_class(APIKeyAuthInfo, self.api_key_auth_info) result["AuthInfo"] = (self.auth_info).to_dict() result["AuthInfoType"] = to_enum(AuthInfoType, self.auth_info_type) result["CancelUserRequestedShellCommandResult"] = to_class(CancelUserRequestedShellCommandResult, self.cancel_user_requested_shell_command_result) result["CanvasAction"] = to_class(CanvasAction, self.canvas_action) result["CanvasActionInvokeRequest"] = to_class(CanvasActionInvokeRequest, self.canvas_action_invoke_request) result["CanvasActionInvokeResult"] = self.canvas_action_invoke_result result["CanvasCloseRequest"] = to_class(CanvasCloseRequest, self.canvas_close_request) result["CanvasHostContext"] = to_class(CanvasHostContext, self.canvas_host_context) result["CanvasHostContextCapabilities"] = to_class(CanvasHostContextCapabilities, self.canvas_host_context_capabilities) result["CanvasJsonSchema"] = self.canvas_json_schema result["CanvasList"] = to_class(CanvasList, self.canvas_list) result["CanvasListOpenResult"] = to_class(CanvasListOpenResult, self.canvas_list_open_result) result["CanvasOpenRequest"] = to_class(CanvasOpenRequest, self.canvas_open_request) result["CanvasProviderCloseRequest"] = to_class(CanvasProviderCloseRequest, self.canvas_provider_close_request) result["CanvasProviderInvokeActionRequest"] = to_class(CanvasProviderInvokeActionRequest, self.canvas_provider_invoke_action_request) result["CanvasProviderOpenRequest"] = to_class(CanvasProviderOpenRequest, self.canvas_provider_open_request) result["CanvasProviderOpenResult"] = to_class(CanvasProviderOpenResult, self.canvas_provider_open_result) result["CanvasSessionContext"] = to_class(CanvasSessionContext, self.canvas_session_context) result["CapiSessionOptions"] = to_class(CapiSessionOptions, self.capi_session_options) result["CommandList"] = to_class(CommandList, self.command_list) result["CommandsHandlePendingCommandRequest"] = to_class(CommandsHandlePendingCommandRequest, self.commands_handle_pending_command_request) result["CommandsHandlePendingCommandResult"] = to_class(CommandsHandlePendingCommandResult, self.commands_handle_pending_command_result) result["CommandsInvokeRequest"] = to_class(CommandsInvokeRequest, self.commands_invoke_request) result["CommandsListRequest"] = to_class(CommandsListRequest, self.commands_list_request) result["CommandsRespondToQueuedCommandRequest"] = to_class(CommandsRespondToQueuedCommandRequest, self.commands_respond_to_queued_command_request) result["CommandsRespondToQueuedCommandResult"] = to_class(CommandsRespondToQueuedCommandResult, self.commands_respond_to_queued_command_result) result["CompletionsGetTriggerCharactersResult"] = to_class(CompletionsGetTriggerCharactersResult, self.completions_get_trigger_characters_result) result["CompletionsRequestRequest"] = to_class(CompletionsRequestRequest, self.completions_request_request) result["CompletionsRequestResult"] = to_class(CompletionsRequestResult, self.completions_request_result) result["ConfigureSessionExtensionsParams"] = to_class(_ConfigureSessionExtensionsParams, self.configure_session_extensions_params) result["ConnectedRemoteSessionMetadata"] = to_class(ConnectedRemoteSessionMetadata, self.connected_remote_session_metadata) result["ConnectedRemoteSessionMetadataKind"] = to_enum(ConnectedRemoteSessionMetadataKind, self.connected_remote_session_metadata_kind) result["ConnectedRemoteSessionMetadataRepository"] = to_class(ConnectedRemoteSessionMetadataRepository, self.connected_remote_session_metadata_repository) result["ConnectRemoteSessionParams"] = to_class(ConnectRemoteSessionParams, self.connect_remote_session_params) result["ConnectRequest"] = to_class(_ConnectRequest, self.connect_request) result["ConnectResult"] = to_class(_ConnectResult, self.connect_result) result["ContentFilterMode"] = to_enum(ContentFilterMode, self.content_filter_mode) result["CopilotApiTokenAuthInfo"] = to_class(CopilotAPITokenAuthInfo, self.copilot_api_token_auth_info) result["CopilotUserResponse"] = to_class(CopilotUserResponse, self.copilot_user_response) result["CopilotUserResponseEndpoints"] = to_class(CopilotUserResponseEndpoints, self.copilot_user_response_endpoints) result["CopilotUserResponseQuotaSnapshots"] = from_dict(lambda x: from_union([lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x), self.copilot_user_response_quota_snapshots) result["CopilotUserResponseQuotaSnapshotsChat"] = to_class(CopilotUserResponseQuotaSnapshotsChat, self.copilot_user_response_quota_snapshots_chat) result["CopilotUserResponseQuotaSnapshotsCompletions"] = to_class(CopilotUserResponseQuotaSnapshotsCompletions, self.copilot_user_response_quota_snapshots_completions) result["CopilotUserResponseQuotaSnapshotsPremiumInteractions"] = to_class(CopilotUserResponseQuotaSnapshotsPremiumInteractions, self.copilot_user_response_quota_snapshots_premium_interactions) result["CurrentModel"] = to_class(CurrentModel, self.current_model) result["CurrentToolMetadata"] = to_class(CurrentToolMetadata, self.current_tool_metadata) result["DiscoveredCanvas"] = to_class(DiscoveredCanvas, self.discovered_canvas) result["DiscoveredMcpServer"] = to_class(DiscoveredMCPServer, self.discovered_mcp_server) result["DiscoveredMcpServerType"] = to_enum(DiscoveredMCPServerType, self.discovered_mcp_server_type) result["EnqueueCommandParams"] = to_class(EnqueueCommandParams, self.enqueue_command_params) result["EnqueueCommandResult"] = to_class(EnqueueCommandResult, self.enqueue_command_result) result["EnvAuthInfo"] = to_class(EnvAuthInfo, self.env_auth_info) result["EventLogReadRequest"] = to_class(EventLogReadRequest, self.event_log_read_request) result["EventLogReleaseInterestResult"] = to_class(EventLogReleaseInterestResult, self.event_log_release_interest_result) result["EventLogTailResult"] = to_class(EventLogTailResult, self.event_log_tail_result) result["EventLogTypes"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x)], self.event_log_types) result["EventsAgentScope"] = to_enum(EventsAgentScope, self.events_agent_scope) result["EventsCursorStatus"] = to_enum(EventsCursorStatus, self.events_cursor_status) result["EventsReadResult"] = to_class(EventsReadResult, self.events_read_result) result["ExecuteCommandParams"] = to_class(ExecuteCommandParams, self.execute_command_params) result["ExecuteCommandResult"] = to_class(ExecuteCommandResult, self.execute_command_result) result["Extension"] = to_class(Extension, self.extension) result["ExtensionContextPushInput"] = to_class(ExtensionContextPushInput, self.extension_context_push_input) result["ExtensionList"] = to_class(ExtensionList, self.extension_list) result["ExtensionsDisableRequest"] = to_class(ExtensionsDisableRequest, self.extensions_disable_request) result["ExtensionsEnableRequest"] = to_class(ExtensionsEnableRequest, self.extensions_enable_request) result["ExtensionSource"] = to_enum(ExtensionSource, self.extension_source) result["ExtensionStatus"] = to_enum(ExtensionStatus, self.extension_status) result["ExternalToolResult"] = from_union([lambda x: to_class(ExternalToolTextResultForLlm, x), from_str], self.external_tool_result) result["ExternalToolTextResultForLlm"] = to_class(ExternalToolTextResultForLlm, self.external_tool_text_result_for_llm) result["ExternalToolTextResultForLlmBinaryResultsForLlm"] = to_class(ExternalToolTextResultForLlmBinaryResultsForLlm, self.external_tool_text_result_for_llm_binary_results_for_llm) result["ExternalToolTextResultForLlmBinaryResultsForLlmType"] = to_enum(ExternalToolTextResultForLlmBinaryResultsForLlmType, self.external_tool_text_result_for_llm_binary_results_for_llm_type) result["ExternalToolTextResultForLlmContent"] = (self.external_tool_text_result_for_llm_content).to_dict() result["ExternalToolTextResultForLlmContentAudio"] = to_class(ExternalToolTextResultForLlmContentAudio, self.external_tool_text_result_for_llm_content_audio) result["ExternalToolTextResultForLlmContentImage"] = to_class(ExternalToolTextResultForLlmContentImage, self.external_tool_text_result_for_llm_content_image) result["ExternalToolTextResultForLlmContentResource"] = to_class(ExternalToolTextResultForLlmContentResource, self.external_tool_text_result_for_llm_content_resource) result["ExternalToolTextResultForLlmContentResourceDetails"] = from_union([lambda x: to_class(EmbeddedTextResourceContents, x), lambda x: to_class(EmbeddedBlobResourceContents, x)], self.external_tool_text_result_for_llm_content_resource_details) result["ExternalToolTextResultForLlmContentResourceLink"] = to_class(ExternalToolTextResultForLlmContentResourceLink, self.external_tool_text_result_for_llm_content_resource_link) result["ExternalToolTextResultForLlmContentResourceLinkIcon"] = to_class(ExternalToolTextResultForLlmContentResourceLinkIcon, self.external_tool_text_result_for_llm_content_resource_link_icon) result["ExternalToolTextResultForLlmContentResourceLinkIconTheme"] = to_enum(Theme, self.external_tool_text_result_for_llm_content_resource_link_icon_theme) result["ExternalToolTextResultForLlmContentShellExit"] = to_class(ExternalToolTextResultForLlmContentShellExit, self.external_tool_text_result_for_llm_content_shell_exit) result["ExternalToolTextResultForLlmContentTerminal"] = to_class(ExternalToolTextResultForLlmContentTerminal, self.external_tool_text_result_for_llm_content_terminal) result["ExternalToolTextResultForLlmContentText"] = to_class(ExternalToolTextResultForLlmContentText, self.external_tool_text_result_for_llm_content_text) result["FilterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x)], self.filter_mapping) result["FleetStartRequest"] = to_class(FleetStartRequest, self.fleet_start_request) result["FleetStartResult"] = to_class(FleetStartResult, self.fleet_start_result) result["FolderTrustAddParams"] = to_class(FolderTrustAddParams, self.folder_trust_add_params) result["FolderTrustCheckParams"] = to_class(FolderTrustCheckParams, self.folder_trust_check_params) result["FolderTrustCheckResult"] = to_class(FolderTrustCheckResult, self.folder_trust_check_result) result["GhCliAuthInfo"] = to_class(GhCLIAuthInfo, self.gh_cli_auth_info) result["GitHubTelemetryClientInfo"] = to_class(GitHubTelemetryClientInfo, self.git_hub_telemetry_client_info) result["GitHubTelemetryEvent"] = to_class(GitHubTelemetryEvent, self.git_hub_telemetry_event) result["GitHubTelemetryNotification"] = to_class(GitHubTelemetryNotification, self.git_hub_telemetry_notification) result["HandlePendingToolCallRequest"] = to_class(HandlePendingToolCallRequest, self.handle_pending_tool_call_request) result["HandlePendingToolCallResult"] = to_class(HandlePendingToolCallResult, self.handle_pending_tool_call_result) result["HistoryAbortManualCompactionResult"] = to_class(HistoryAbortManualCompactionResult, self.history_abort_manual_compaction_result) result["HistoryCancelBackgroundCompactionResult"] = to_class(HistoryCancelBackgroundCompactionResult, self.history_cancel_background_compaction_result) result["HistoryCompactContextWindow"] = to_class(HistoryCompactContextWindow, self.history_compact_context_window) result["HistoryCompactRequest"] = to_class(HistoryCompactRequest, self.history_compact_request) result["HistoryCompactResult"] = to_class(HistoryCompactResult, self.history_compact_result) result["HistorySummarizeForHandoffResult"] = to_class(HistorySummarizeForHandoffResult, self.history_summarize_for_handoff_result) result["HistoryTruncateRequest"] = to_class(HistoryTruncateRequest, self.history_truncate_request) result["HistoryTruncateResult"] = to_class(HistoryTruncateResult, self.history_truncate_result) result["HMACAuthInfo"] = to_class(HMACAuthInfo, self.hmac_auth_info) result["InstalledPlugin"] = to_class(InstalledPlugin, self.installed_plugin) result["InstalledPluginInfo"] = to_class(InstalledPluginInfo, self.installed_plugin_info) result["InstalledPluginSource"] = from_union([lambda x: to_class(InstalledPluginSource, x), from_str], self.installed_plugin_source) result["InstalledPluginSourceGitHub"] = to_class(InstalledPluginSourceGitHub, self.installed_plugin_source_git_hub) result["InstalledPluginSourceLocal"] = to_class(InstalledPluginSourceLocal, self.installed_plugin_source_local) result["InstalledPluginSourceUrl"] = to_class(InstalledPluginSourceURL, self.installed_plugin_source_url) result["InstructionDiscoveryPath"] = to_class(InstructionDiscoveryPath, self.instruction_discovery_path) result["InstructionDiscoveryPathKind"] = to_enum(InstructionDiscoveryPathKind, self.instruction_discovery_path_kind) result["InstructionDiscoveryPathList"] = to_class(InstructionDiscoveryPathList, self.instruction_discovery_path_list) result["InstructionDiscoveryPathLocation"] = to_enum(InstructionLocation, self.instruction_discovery_path_location) result["InstructionsDiscoverRequest"] = to_class(InstructionsDiscoverRequest, self.instructions_discover_request) result["InstructionsGetDiscoveryPathsRequest"] = to_class(InstructionsGetDiscoveryPathsRequest, self.instructions_get_discovery_paths_request) result["InstructionsGetSourcesResult"] = to_class(InstructionsGetSourcesResult, self.instructions_get_sources_result) result["InstructionSource"] = to_class(InstructionSource, self.instruction_source) result["InstructionSourceLocation"] = to_enum(InstructionLocation, self.instruction_source_location) result["InstructionSourceType"] = to_enum(InstructionSourceType, self.instruction_source_type) result["LlmInferenceHeaders"] = from_dict(lambda x: from_list(from_str, x), self.llm_inference_headers) result["LlmInferenceHttpRequestChunkRequest"] = to_class(LlmInferenceHTTPRequestChunkRequest, self.llm_inference_http_request_chunk_request) result["LlmInferenceHttpRequestChunkResult"] = to_class(LlmInferenceHTTPRequestChunkResult, self.llm_inference_http_request_chunk_result) result["LlmInferenceHttpRequestStartRequest"] = to_class(LlmInferenceHTTPRequestStartRequest, self.llm_inference_http_request_start_request) result["LlmInferenceHttpRequestStartResult"] = to_class(LlmInferenceHTTPRequestStartResult, self.llm_inference_http_request_start_result) result["LlmInferenceHttpRequestStartTransport"] = to_enum(LlmInferenceHTTPRequestStartTransport, self.llm_inference_http_request_start_transport) result["LlmInferenceHttpResponseChunkError"] = to_class(LlmInferenceHTTPResponseChunkError, self.llm_inference_http_response_chunk_error) result["LlmInferenceHttpResponseChunkRequest"] = to_class(LlmInferenceHTTPResponseChunkRequest, self.llm_inference_http_response_chunk_request) result["LlmInferenceHttpResponseChunkResult"] = to_class(LlmInferenceHTTPResponseChunkResult, self.llm_inference_http_response_chunk_result) result["LlmInferenceHttpResponseStartRequest"] = to_class(LlmInferenceHTTPResponseStartRequest, self.llm_inference_http_response_start_request) result["LlmInferenceHttpResponseStartResult"] = to_class(LlmInferenceHTTPResponseStartResult, self.llm_inference_http_response_start_result) result["LlmInferenceSetProviderResult"] = to_class(LlmInferenceSetProviderResult, self.llm_inference_set_provider_result) result["LocalSessionMetadataValue"] = to_class(LocalSessionMetadataValue, self.local_session_metadata_value) result["LogRequest"] = to_class(LogRequest, self.log_request) result["LogResult"] = to_class(LogResult, self.log_result) result["LspInitializeRequest"] = to_class(LspInitializeRequest, self.lsp_initialize_request) result["MarketplaceAddResult"] = to_class(MarketplaceAddResult, self.marketplace_add_result) result["MarketplaceBrowseResult"] = to_class(MarketplaceBrowseResult, self.marketplace_browse_result) result["MarketplaceInfo"] = to_class(MarketplaceInfo, self.marketplace_info) result["MarketplaceListResult"] = to_class(MarketplaceListResult, self.marketplace_list_result) result["MarketplacePluginInfo"] = to_class(MarketplacePluginInfo, self.marketplace_plugin_info) result["MarketplaceRefreshEntry"] = to_class(MarketplaceRefreshEntry, self.marketplace_refresh_entry) result["MarketplaceRefreshResult"] = to_class(MarketplaceRefreshResult, self.marketplace_refresh_result) result["MarketplaceRemoveResult"] = to_class(MarketplaceRemoveResult, self.marketplace_remove_result) result["McpAllowedServer"] = to_class(MCPAllowedServer, self.mcp_allowed_server) result["McpAppsCallToolRequest"] = to_class(MCPAppsCallToolRequest, self.mcp_apps_call_tool_request) result["McpAppsDiagnoseCapability"] = to_class(MCPAppsDiagnoseCapability, self.mcp_apps_diagnose_capability) result["McpAppsDiagnoseRequest"] = to_class(MCPAppsDiagnoseRequest, self.mcp_apps_diagnose_request) result["McpAppsDiagnoseResult"] = to_class(MCPAppsDiagnoseResult, self.mcp_apps_diagnose_result) result["McpAppsDiagnoseServer"] = to_class(MCPAppsDiagnoseServer, self.mcp_apps_diagnose_server) result["McpAppsHostContext"] = to_class(MCPAppsHostContext, self.mcp_apps_host_context) result["McpAppsHostContextDetails"] = to_class(MCPAppsHostContextDetails, self.mcp_apps_host_context_details) result["McpAppsHostContextDetailsAvailableDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_host_context_details_available_display_mode) result["McpAppsHostContextDetailsDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_host_context_details_display_mode) result["McpAppsHostContextDetailsPlatform"] = to_enum(MCPAppsHostContextDetailsPlatform, self.mcp_apps_host_context_details_platform) result["McpAppsHostContextDetailsTheme"] = to_enum(Theme, self.mcp_apps_host_context_details_theme) result["McpAppsListToolsRequest"] = to_class(MCPAppsListToolsRequest, self.mcp_apps_list_tools_request) result["McpAppsListToolsResult"] = to_class(MCPAppsListToolsResult, self.mcp_apps_list_tools_result) result["McpAppsReadResourceRequest"] = to_class(MCPAppsReadResourceRequest, self.mcp_apps_read_resource_request) result["McpAppsReadResourceResult"] = to_class(MCPAppsReadResourceResult, self.mcp_apps_read_resource_result) result["McpAppsResourceContent"] = to_class(MCPAppsResourceContent, self.mcp_apps_resource_content) result["McpAppsSetHostContextDetails"] = to_class(MCPAppsSetHostContextDetails, self.mcp_apps_set_host_context_details) result["McpAppsSetHostContextDetailsAvailableDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_available_display_mode) result["McpAppsSetHostContextDetailsDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_display_mode) result["McpAppsSetHostContextDetailsPlatform"] = to_enum(MCPAppsHostContextDetailsPlatform, self.mcp_apps_set_host_context_details_platform) result["McpAppsSetHostContextDetailsTheme"] = to_enum(Theme, self.mcp_apps_set_host_context_details_theme) result["McpAppsSetHostContextRequest"] = to_class(MCPAppsSetHostContextRequest, self.mcp_apps_set_host_context_request) result["McpCancelSamplingExecutionParams"] = to_class(MCPCancelSamplingExecutionParams, self.mcp_cancel_sampling_execution_params) result["McpCancelSamplingExecutionResult"] = to_class(MCPCancelSamplingExecutionResult, self.mcp_cancel_sampling_execution_result) result["McpConfigAddRequest"] = to_class(MCPConfigAddRequest, self.mcp_config_add_request) result["McpConfigDisableRequest"] = to_class(MCPConfigDisableRequest, self.mcp_config_disable_request) result["McpConfigEnableRequest"] = to_class(MCPConfigEnableRequest, self.mcp_config_enable_request) result["McpConfigList"] = to_class(MCPConfigList, self.mcp_config_list) result["McpConfigRemoveRequest"] = to_class(MCPConfigRemoveRequest, self.mcp_config_remove_request) result["McpConfigUpdateRequest"] = to_class(MCPConfigUpdateRequest, self.mcp_config_update_request) result["McpConfigureGitHubRequest"] = to_class(MCPConfigureGitHubRequest, self.mcp_configure_git_hub_request) result["McpConfigureGitHubResult"] = to_class(MCPConfigureGitHubResult, self.mcp_configure_git_hub_result) result["McpDisableRequest"] = to_class(MCPDisableRequest, self.mcp_disable_request) result["McpDiscoverRequest"] = to_class(MCPDiscoverRequest, self.mcp_discover_request) result["McpDiscoverResult"] = to_class(MCPDiscoverResult, self.mcp_discover_result) result["McpEnableRequest"] = to_class(MCPEnableRequest, self.mcp_enable_request) result["McpExecuteSamplingParams"] = to_class(MCPExecuteSamplingParams, self.mcp_execute_sampling_params) result["McpExecuteSamplingRequest"] = from_dict(lambda x: x, self.mcp_execute_sampling_request) result["McpExecuteSamplingResult"] = from_dict(lambda x: x, self.mcp_execute_sampling_result) result["McpFilteredServer"] = to_class(MCPFilteredServer, self.mcp_filtered_server) result["McpHeadersHandlePendingHeadersRefreshRequest"] = to_class(MCPHeadersHandlePendingHeadersRefreshRequest, self.mcp_headers_handle_pending_headers_refresh_request) result["McpHeadersHandlePendingHeadersRefreshRequestRequest"] = to_class(MCPHeadersHandlePendingHeadersRefreshRequestRequest, self.mcp_headers_handle_pending_headers_refresh_request_request) result["McpHeadersHandlePendingHeadersRefreshRequestResult"] = to_class(MCPHeadersHandlePendingHeadersRefreshRequestResult, self.mcp_headers_handle_pending_headers_refresh_request_result) result["McpHostState"] = to_class(MCPHostState, self.mcp_host_state) result["McpIsServerRunningRequest"] = to_class(MCPIsServerRunningRequest, self.mcp_is_server_running_request) result["McpIsServerRunningResult"] = to_class(MCPIsServerRunningResult, self.mcp_is_server_running_result) result["McpListToolsRequest"] = to_class(MCPListToolsRequest, self.mcp_list_tools_request) result["McpListToolsResult"] = to_class(MCPListToolsResult, self.mcp_list_tools_result) result["McpOauthHandlePendingRequest"] = to_class(MCPOauthHandlePendingRequest, self.mcp_oauth_handle_pending_request) result["McpOauthHandlePendingResult"] = to_class(MCPOauthHandlePendingResult, self.mcp_oauth_handle_pending_result) result["McpOauthLoginGrantType"] = to_enum(MCPGrantType, self.mcp_oauth_login_grant_type) result["McpOauthLoginRequest"] = to_class(MCPOauthLoginRequest, self.mcp_oauth_login_request) result["McpOauthLoginResult"] = to_class(MCPOauthLoginResult, self.mcp_oauth_login_result) result["McpOauthPendingRequestResponse"] = to_class(MCPOauthPendingRequestResponse, self.mcp_oauth_pending_request_response) result["McpOauthRespondRequest"] = to_class(MCPOauthRespondRequest, self.mcp_oauth_respond_request) result["McpOauthRespondResult"] = to_class(MCPOauthRespondResult, self.mcp_oauth_respond_result) result["McpRegisterExternalClientRequest"] = to_class(MCPRegisterExternalClientRequest, self.mcp_register_external_client_request) result["McpReloadWithConfigRequest"] = to_class(MCPReloadWithConfigRequest, self.mcp_reload_with_config_request) result["McpRemoveGitHubResult"] = to_class(MCPRemoveGitHubResult, self.mcp_remove_git_hub_result) result["McpRestartServerRequest"] = to_class(MCPRestartServerRequest, self.mcp_restart_server_request) result["McpSamplingExecutionAction"] = to_enum(MCPSamplingExecutionAction, self.mcp_sampling_execution_action) result["McpSamplingExecutionResult"] = to_class(MCPSamplingExecutionResult, self.mcp_sampling_execution_result) result["McpServer"] = to_class(MCPServer, self.mcp_server) result["McpServerAuthConfig"] = from_union([from_bool, lambda x: to_class(MCPServerAuthConfigRedirectPort, x)], self.mcp_server_auth_config) result["McpServerAuthConfigRedirectPort"] = to_class(MCPServerAuthConfigRedirectPort, self.mcp_server_auth_config_redirect_port) result["McpServerConfig"] = to_class(MCPServerConfig, self.mcp_server_config) result["McpServerConfigDeferTools"] = to_enum(MCPServerConfigDeferTools, self.mcp_server_config_defer_tools) result["McpServerConfigHttp"] = to_class(MCPServerConfigHTTP, self.mcp_server_config_http) result["McpServerConfigHttpOauthGrantType"] = to_enum(MCPGrantType, self.mcp_server_config_http_oauth_grant_type) result["McpServerConfigHttpType"] = to_enum(MCPServerConfigHTTPType, self.mcp_server_config_http_type) result["McpServerConfigStdio"] = to_class(MCPServerConfigStdio, self.mcp_server_config_stdio) result["McpServerFailureInfo"] = to_class(MCPServerFailureInfo, self.mcp_server_failure_info) result["McpServerList"] = to_class(MCPServerList, self.mcp_server_list) result["McpServerNeedsAuthInfo"] = to_class(MCPServerNeedsAuthInfo, self.mcp_server_needs_auth_info) result["McpSetEnvValueModeDetails"] = to_enum(MCPSetEnvValueModeDetails, self.mcp_set_env_value_mode_details) result["McpSetEnvValueModeParams"] = to_class(MCPSetEnvValueModeParams, self.mcp_set_env_value_mode_params) result["McpSetEnvValueModeResult"] = to_class(MCPSetEnvValueModeResult, self.mcp_set_env_value_mode_result) result["McpStartServerRequest"] = to_class(MCPStartServerRequest, self.mcp_start_server_request) result["McpStartServersResult"] = to_class(MCPStartServersResult, self.mcp_start_servers_result) result["McpStopServerRequest"] = to_class(MCPStopServerRequest, self.mcp_stop_server_request) result["McpTools"] = to_class(MCPTools, self.mcp_tools) result["McpUnregisterExternalClientRequest"] = to_class(MCPUnregisterExternalClientRequest, self.mcp_unregister_external_client_request) result["MemoryConfiguration"] = to_class(MemoryConfiguration, self.memory_configuration) result["MetadataContextInfoRequest"] = to_class(MetadataContextInfoRequest, self.metadata_context_info_request) result["MetadataContextInfoResult"] = to_class(MetadataContextInfoResult, self.metadata_context_info_result) result["MetadataIsProcessingResult"] = to_class(MetadataIsProcessingResult, self.metadata_is_processing_result) result["MetadataRecomputeContextTokensRequest"] = to_class(MetadataRecomputeContextTokensRequest, self.metadata_recompute_context_tokens_request) result["MetadataRecomputeContextTokensResult"] = to_class(MetadataRecomputeContextTokensResult, self.metadata_recompute_context_tokens_result) result["MetadataRecordContextChangeRequest"] = to_class(MetadataRecordContextChangeRequest, self.metadata_record_context_change_request) result["MetadataRecordContextChangeResult"] = to_class(MetadataRecordContextChangeResult, self.metadata_record_context_change_result) result["MetadataSetWorkingDirectoryRequest"] = to_class(MetadataSetWorkingDirectoryRequest, self.metadata_set_working_directory_request) result["MetadataSetWorkingDirectoryResult"] = to_class(MetadataSetWorkingDirectoryResult, self.metadata_set_working_directory_result) result["MetadataSnapshotCurrentMode"] = to_enum(MetadataSnapshotCurrentMode, self.metadata_snapshot_current_mode) result["MetadataSnapshotRemoteMetadata"] = to_class(MetadataSnapshotRemoteMetadata, self.metadata_snapshot_remote_metadata) result["MetadataSnapshotRemoteMetadataRepository"] = to_class(MetadataSnapshotRemoteMetadataRepository, self.metadata_snapshot_remote_metadata_repository) result["MetadataSnapshotRemoteMetadataTaskType"] = to_enum(TaskType, self.metadata_snapshot_remote_metadata_task_type) result["Model"] = to_class(Model, self.model) result["ModelBilling"] = to_class(ModelBilling, self.model_billing) result["ModelBillingTokenPrices"] = to_class(ModelBillingTokenPrices, self.model_billing_token_prices) result["ModelBillingTokenPricesLongContext"] = to_class(ModelBillingTokenPricesLongContext, self.model_billing_token_prices_long_context) result["ModelCapabilities"] = to_class(ModelCapabilities, self.model_capabilities) result["ModelCapabilitiesLimits"] = to_class(ModelCapabilitiesLimits, self.model_capabilities_limits) result["ModelCapabilitiesLimitsVision"] = to_class(ModelCapabilitiesLimitsVision, self.model_capabilities_limits_vision) result["ModelCapabilitiesOverride"] = to_class(ModelCapabilitiesOverride, self.model_capabilities_override) result["ModelCapabilitiesOverrideLimits"] = to_class(ModelCapabilitiesOverrideLimits, self.model_capabilities_override_limits) result["ModelCapabilitiesOverrideLimitsVision"] = to_class(ModelCapabilitiesOverrideLimitsVision, self.model_capabilities_override_limits_vision) result["ModelCapabilitiesOverrideSupports"] = to_class(ModelCapabilitiesOverrideSupports, self.model_capabilities_override_supports) result["ModelCapabilitiesSupports"] = to_class(ModelCapabilitiesSupports, self.model_capabilities_supports) result["ModelList"] = to_class(ModelList, self.model_list) result["ModelListRequest"] = to_class(ModelListRequest, self.model_list_request) result["ModelPickerCategory"] = to_enum(ModelPickerCategory, self.model_picker_category) result["ModelPickerPriceCategory"] = to_enum(ModelPickerPriceCategory, self.model_picker_price_category) result["ModelPolicy"] = to_class(ModelPolicy, self.model_policy) result["ModelPolicyState"] = to_enum(ModelPolicyState, self.model_policy_state) result["ModelSetReasoningEffortRequest"] = to_class(ModelSetReasoningEffortRequest, self.model_set_reasoning_effort_request) result["ModelSetReasoningEffortResult"] = to_class(ModelSetReasoningEffortResult, self.model_set_reasoning_effort_result) result["ModelsListRequest"] = to_class(ModelsListRequest, self.models_list_request) result["ModelSwitchToRequest"] = to_class(ModelSwitchToRequest, self.model_switch_to_request) result["ModelSwitchToResult"] = to_class(ModelSwitchToResult, self.model_switch_to_result) result["ModeSetRequest"] = to_class(ModeSetRequest, self.mode_set_request) result["NamedProviderConfig"] = to_class(NamedProviderConfig, self.named_provider_config) result["NameGetResult"] = to_class(NameGetResult, self.name_get_result) result["NameSetAutoRequest"] = to_class(NameSetAutoRequest, self.name_set_auto_request) result["NameSetAutoResult"] = to_class(NameSetAutoResult, self.name_set_auto_result) result["NameSetRequest"] = to_class(NameSetRequest, self.name_set_request) result["OpenCanvasInstance"] = to_class(OpenCanvasInstance, self.open_canvas_instance) result["OptionsUpdateAdditionalContentExclusionPolicy"] = to_class(OptionsUpdateAdditionalContentExclusionPolicy, self.options_update_additional_content_exclusion_policy) result["OptionsUpdateAdditionalContentExclusionPolicyRule"] = to_class(OptionsUpdateAdditionalContentExclusionPolicyRule, self.options_update_additional_content_exclusion_policy_rule) result["OptionsUpdateAdditionalContentExclusionPolicyRuleSource"] = to_class(OptionsUpdateAdditionalContentExclusionPolicyRuleSource, self.options_update_additional_content_exclusion_policy_rule_source) result["OptionsUpdateAdditionalContentExclusionPolicyScope"] = to_enum(AdditionalContentExclusionPolicyScope, self.options_update_additional_content_exclusion_policy_scope) result["OptionsUpdateContextTier"] = to_enum(OptionsUpdateContextTier, self.options_update_context_tier) result["OptionsUpdateEnvValueMode"] = to_enum(MCPSetEnvValueModeDetails, self.options_update_env_value_mode) result["OptionsUpdateReasoningSummary"] = to_enum(ReasoningSummary, self.options_update_reasoning_summary) result["OptionsUpdateToolFilterPrecedence"] = to_enum(OptionsUpdateToolFilterPrecedence, self.options_update_tool_filter_precedence) result["PendingPermissionRequest"] = to_class(PendingPermissionRequest, self.pending_permission_request) result["PendingPermissionRequestList"] = to_class(PendingPermissionRequestList, self.pending_permission_request_list) result["PermissionDecision"] = (self.permission_decision).to_dict() result["PermissionDecisionApproved"] = to_class(PermissionDecisionApproved, self.permission_decision_approved) result["PermissionDecisionApprovedForLocation"] = to_class(PermissionDecisionApprovedForLocation, self.permission_decision_approved_for_location) result["PermissionDecisionApprovedForSession"] = to_class(PermissionDecisionApprovedForSession, self.permission_decision_approved_for_session) result["PermissionDecisionApproveForLocation"] = to_class(PermissionDecisionApproveForLocation, self.permission_decision_approve_for_location) result["PermissionDecisionApproveForLocationApproval"] = (self.permission_decision_approve_for_location_approval).to_dict() result["PermissionDecisionApproveForLocationApprovalCommands"] = to_class(PermissionDecisionApproveForLocationApprovalCommands, self.permission_decision_approve_for_location_approval_commands) result["PermissionDecisionApproveForLocationApprovalCustomTool"] = to_class(PermissionDecisionApproveForLocationApprovalCustomTool, self.permission_decision_approve_for_location_approval_custom_tool) result["PermissionDecisionApproveForLocationApprovalExtensionManagement"] = to_class(PermissionDecisionApproveForLocationApprovalExtensionManagement, self.permission_decision_approve_for_location_approval_extension_management) result["PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess"] = to_class(PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess, self.permission_decision_approve_for_location_approval_extension_permission_access) result["PermissionDecisionApproveForLocationApprovalMcp"] = to_class(PermissionDecisionApproveForLocationApprovalMCP, self.permission_decision_approve_for_location_approval_mcp) result["PermissionDecisionApproveForLocationApprovalMcpSampling"] = to_class(PermissionDecisionApproveForLocationApprovalMCPSampling, self.permission_decision_approve_for_location_approval_mcp_sampling) result["PermissionDecisionApproveForLocationApprovalMemory"] = to_class(PermissionDecisionApproveForLocationApprovalMemory, self.permission_decision_approve_for_location_approval_memory) result["PermissionDecisionApproveForLocationApprovalRead"] = to_class(PermissionDecisionApproveForLocationApprovalRead, self.permission_decision_approve_for_location_approval_read) result["PermissionDecisionApproveForLocationApprovalWrite"] = to_class(PermissionDecisionApproveForLocationApprovalWrite, self.permission_decision_approve_for_location_approval_write) result["PermissionDecisionApproveForSession"] = to_class(PermissionDecisionApproveForSession, self.permission_decision_approve_for_session) result["PermissionDecisionApproveForSessionApproval"] = (self.permission_decision_approve_for_session_approval).to_dict() result["PermissionDecisionApproveForSessionApprovalCommands"] = to_class(PermissionDecisionApproveForSessionApprovalCommands, self.permission_decision_approve_for_session_approval_commands) result["PermissionDecisionApproveForSessionApprovalCustomTool"] = to_class(PermissionDecisionApproveForSessionApprovalCustomTool, self.permission_decision_approve_for_session_approval_custom_tool) result["PermissionDecisionApproveForSessionApprovalExtensionManagement"] = to_class(PermissionDecisionApproveForSessionApprovalExtensionManagement, self.permission_decision_approve_for_session_approval_extension_management) result["PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess"] = to_class(PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess, self.permission_decision_approve_for_session_approval_extension_permission_access) result["PermissionDecisionApproveForSessionApprovalMcp"] = to_class(PermissionDecisionApproveForSessionApprovalMCP, self.permission_decision_approve_for_session_approval_mcp) result["PermissionDecisionApproveForSessionApprovalMcpSampling"] = to_class(PermissionDecisionApproveForSessionApprovalMCPSampling, self.permission_decision_approve_for_session_approval_mcp_sampling) result["PermissionDecisionApproveForSessionApprovalMemory"] = to_class(PermissionDecisionApproveForSessionApprovalMemory, self.permission_decision_approve_for_session_approval_memory) result["PermissionDecisionApproveForSessionApprovalRead"] = to_class(PermissionDecisionApproveForSessionApprovalRead, self.permission_decision_approve_for_session_approval_read) result["PermissionDecisionApproveForSessionApprovalWrite"] = to_class(PermissionDecisionApproveForSessionApprovalWrite, self.permission_decision_approve_for_session_approval_write) result["PermissionDecisionApproveOnce"] = to_class(PermissionDecisionApproveOnce, self.permission_decision_approve_once) result["PermissionDecisionApprovePermanently"] = to_class(PermissionDecisionApprovePermanently, self.permission_decision_approve_permanently) result["PermissionDecisionCancelled"] = to_class(PermissionDecisionCancelled, self.permission_decision_cancelled) result["PermissionDecisionDeniedByContentExclusionPolicy"] = to_class(PermissionDecisionDeniedByContentExclusionPolicy, self.permission_decision_denied_by_content_exclusion_policy) result["PermissionDecisionDeniedByPermissionRequestHook"] = to_class(PermissionDecisionDeniedByPermissionRequestHook, self.permission_decision_denied_by_permission_request_hook) result["PermissionDecisionDeniedByRules"] = to_class(PermissionDecisionDeniedByRules, self.permission_decision_denied_by_rules) result["PermissionDecisionDeniedInteractivelyByUser"] = to_class(PermissionDecisionDeniedInteractivelyByUser, self.permission_decision_denied_interactively_by_user) result["PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser"] = to_class(PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser, self.permission_decision_denied_no_approval_rule_and_could_not_request_from_user) result["PermissionDecisionReject"] = to_class(PermissionDecisionReject, self.permission_decision_reject) result["PermissionDecisionRequest"] = to_class(PermissionDecisionRequest, self.permission_decision_request) result["PermissionDecisionUserNotAvailable"] = to_class(PermissionDecisionUserNotAvailable, self.permission_decision_user_not_available) result["PermissionLocationAddToolApprovalParams"] = to_class(PermissionLocationAddToolApprovalParams, self.permission_location_add_tool_approval_params) result["PermissionLocationApplyParams"] = to_class(PermissionLocationApplyParams, self.permission_location_apply_params) result["PermissionLocationApplyResult"] = to_class(PermissionLocationApplyResult, self.permission_location_apply_result) result["PermissionLocationResolveParams"] = to_class(PermissionLocationResolveParams, self.permission_location_resolve_params) result["PermissionLocationResolveResult"] = to_class(PermissionLocationResolveResult, self.permission_location_resolve_result) result["PermissionLocationType"] = to_enum(PermissionLocationType, self.permission_location_type) result["PermissionPathsAddParams"] = to_class(PermissionPathsAddParams, self.permission_paths_add_params) result["PermissionPathsAllowedCheckParams"] = to_class(PermissionPathsAllowedCheckParams, self.permission_paths_allowed_check_params) result["PermissionPathsAllowedCheckResult"] = to_class(PermissionPathsAllowedCheckResult, self.permission_paths_allowed_check_result) result["PermissionPathsConfig"] = to_class(PermissionPathsConfig, self.permission_paths_config) result["PermissionPathsList"] = to_class(PermissionPathsList, self.permission_paths_list) result["PermissionPathsUpdatePrimaryParams"] = to_class(PermissionPathsUpdatePrimaryParams, self.permission_paths_update_primary_params) result["PermissionPathsWorkspaceCheckParams"] = to_class(PermissionPathsWorkspaceCheckParams, self.permission_paths_workspace_check_params) result["PermissionPathsWorkspaceCheckResult"] = to_class(PermissionPathsWorkspaceCheckResult, self.permission_paths_workspace_check_result) result["PermissionPromptShownNotification"] = to_class(PermissionPromptShownNotification, self.permission_prompt_shown_notification) result["PermissionRequestResult"] = to_class(PermissionRequestResult, self.permission_request_result) result["PermissionRulesSet"] = to_class(PermissionRulesSet, self.permission_rules_set) result["PermissionsConfigureAdditionalContentExclusionPolicy"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicy, self.permissions_configure_additional_content_exclusion_policy) result["PermissionsConfigureAdditionalContentExclusionPolicyRule"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, self.permissions_configure_additional_content_exclusion_policy_rule) result["PermissionsConfigureAdditionalContentExclusionPolicyRuleSource"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.permissions_configure_additional_content_exclusion_policy_rule_source) result["PermissionsConfigureAdditionalContentExclusionPolicyScope"] = to_enum(AdditionalContentExclusionPolicyScope, self.permissions_configure_additional_content_exclusion_policy_scope) result["PermissionsConfigureParams"] = to_class(PermissionsConfigureParams, self.permissions_configure_params) result["PermissionsConfigureResult"] = to_class(PermissionsConfigureResult, self.permissions_configure_result) result["PermissionsFolderTrustAddTrustedResult"] = to_class(PermissionsFolderTrustAddTrustedResult, self.permissions_folder_trust_add_trusted_result) result["PermissionsGetAllowAllRequest"] = to_class(PermissionsGetAllowAllRequest, self.permissions_get_allow_all_request) result["PermissionsLocationsAddToolApprovalDetails"] = (self.permissions_locations_add_tool_approval_details).to_dict() result["PermissionsLocationsAddToolApprovalDetailsCommands"] = to_class(PermissionsLocationsAddToolApprovalDetailsCommands, self.permissions_locations_add_tool_approval_details_commands) result["PermissionsLocationsAddToolApprovalDetailsCustomTool"] = to_class(PermissionsLocationsAddToolApprovalDetailsCustomTool, self.permissions_locations_add_tool_approval_details_custom_tool) result["PermissionsLocationsAddToolApprovalDetailsExtensionManagement"] = to_class(PermissionsLocationsAddToolApprovalDetailsExtensionManagement, self.permissions_locations_add_tool_approval_details_extension_management) result["PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess"] = to_class(PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess, self.permissions_locations_add_tool_approval_details_extension_permission_access) result["PermissionsLocationsAddToolApprovalDetailsMcp"] = to_class(PermissionsLocationsAddToolApprovalDetailsMCP, self.permissions_locations_add_tool_approval_details_mcp) result["PermissionsLocationsAddToolApprovalDetailsMcpSampling"] = to_class(PermissionsLocationsAddToolApprovalDetailsMCPSampling, self.permissions_locations_add_tool_approval_details_mcp_sampling) result["PermissionsLocationsAddToolApprovalDetailsMemory"] = to_class(PermissionsLocationsAddToolApprovalDetailsMemory, self.permissions_locations_add_tool_approval_details_memory) result["PermissionsLocationsAddToolApprovalDetailsRead"] = to_class(PermissionsLocationsAddToolApprovalDetailsRead, self.permissions_locations_add_tool_approval_details_read) result["PermissionsLocationsAddToolApprovalDetailsWrite"] = to_class(PermissionsLocationsAddToolApprovalDetailsWrite, self.permissions_locations_add_tool_approval_details_write) result["PermissionsLocationsAddToolApprovalResult"] = to_class(PermissionsLocationsAddToolApprovalResult, self.permissions_locations_add_tool_approval_result) result["PermissionsModifyRulesParams"] = to_class(PermissionsModifyRulesParams, self.permissions_modify_rules_params) result["PermissionsModifyRulesResult"] = to_class(PermissionsModifyRulesResult, self.permissions_modify_rules_result) result["PermissionsModifyRulesScope"] = to_enum(PermissionsModifyRulesScope, self.permissions_modify_rules_scope) result["PermissionsNotifyPromptShownResult"] = to_class(PermissionsNotifyPromptShownResult, self.permissions_notify_prompt_shown_result) result["PermissionsPathsAddResult"] = to_class(PermissionsPathsAddResult, self.permissions_paths_add_result) result["PermissionsPathsListRequest"] = to_class(PermissionsPathsListRequest, self.permissions_paths_list_request) result["PermissionsPathsUpdatePrimaryResult"] = to_class(PermissionsPathsUpdatePrimaryResult, self.permissions_paths_update_primary_result) result["PermissionsPendingRequestsRequest"] = to_class(PermissionsPendingRequestsRequest, self.permissions_pending_requests_request) result["PermissionsResetSessionApprovalsRequest"] = to_class(PermissionsResetSessionApprovalsRequest, self.permissions_reset_session_approvals_request) result["PermissionsResetSessionApprovalsResult"] = to_class(PermissionsResetSessionApprovalsResult, self.permissions_reset_session_approvals_result) result["PermissionsSetAllowAllRequest"] = to_class(PermissionsSetAllowAllRequest, self.permissions_set_allow_all_request) result["PermissionsSetAllowAllSource"] = to_enum(PermissionsSetAAllSource, self.permissions_set_allow_all_source) result["PermissionsSetApproveAllRequest"] = to_class(PermissionsSetApproveAllRequest, self.permissions_set_approve_all_request) result["PermissionsSetApproveAllResult"] = to_class(PermissionsSetApproveAllResult, self.permissions_set_approve_all_result) result["PermissionsSetApproveAllSource"] = to_enum(PermissionsSetAAllSource, self.permissions_set_approve_all_source) result["PermissionsSetRequiredRequest"] = to_class(PermissionsSetRequiredRequest, self.permissions_set_required_request) result["PermissionsSetRequiredResult"] = to_class(PermissionsSetRequiredResult, self.permissions_set_required_result) result["PermissionsUrlsSetUnrestrictedModeResult"] = to_class(PermissionsUrlsSetUnrestrictedModeResult, self.permissions_urls_set_unrestricted_mode_result) result["PermissionUrlsConfig"] = to_class(PermissionUrlsConfig, self.permission_urls_config) result["PermissionUrlsSetUnrestrictedModeParams"] = to_class(PermissionUrlsSetUnrestrictedModeParams, self.permission_urls_set_unrestricted_mode_params) result["PingRequest"] = to_class(PingRequest, self.ping_request) result["PingResult"] = to_class(PingResult, self.ping_result) result["PlanReadResult"] = to_class(PlanReadResult, self.plan_read_result) result["PlanReadSqlTodosResult"] = to_class(PlanReadSQLTodosResult, self.plan_read_sql_todos_result) result["PlanReadSqlTodosWithDependenciesResult"] = to_class(PlanReadSQLTodosWithDependenciesResult, self.plan_read_sql_todos_with_dependencies_result) result["PlanSqlTodoDependency"] = to_class(PlanSQLTodoDependency, self.plan_sql_todo_dependency) result["PlanSqlTodosRow"] = to_class(PlanSQLTodosRow, self.plan_sql_todos_row) result["PlanUpdateRequest"] = to_class(PlanUpdateRequest, self.plan_update_request) result["Plugin"] = to_class(Plugin, self.plugin) result["PluginInstallResult"] = to_class(PluginInstallResult, self.plugin_install_result) result["PluginList"] = to_class(PluginList, self.plugin_list) result["PluginListResult"] = to_class(PluginListResult, self.plugin_list_result) result["PluginsDisableRequest"] = to_class(PluginsDisableRequest, self.plugins_disable_request) result["PluginsEnableRequest"] = to_class(PluginsEnableRequest, self.plugins_enable_request) result["PluginsInstallRequest"] = to_class(PluginsInstallRequest, self.plugins_install_request) result["PluginsMarketplacesAddRequest"] = to_class(PluginsMarketplacesAddRequest, self.plugins_marketplaces_add_request) result["PluginsMarketplacesBrowseRequest"] = to_class(PluginsMarketplacesBrowseRequest, self.plugins_marketplaces_browse_request) result["PluginsMarketplacesRefreshRequest"] = to_class(PluginsMarketplacesRefreshRequest, self.plugins_marketplaces_refresh_request) result["PluginsMarketplacesRemoveRequest"] = to_class(PluginsMarketplacesRemoveRequest, self.plugins_marketplaces_remove_request) result["PluginsReloadRequest"] = to_class(PluginsReloadRequest, self.plugins_reload_request) result["PluginsUninstallRequest"] = to_class(PluginsUninstallRequest, self.plugins_uninstall_request) result["PluginsUpdateRequest"] = to_class(PluginsUpdateRequest, self.plugins_update_request) result["PluginUpdateAllEntry"] = to_class(PluginUpdateAllEntry, self.plugin_update_all_entry) result["PluginUpdateAllResult"] = to_class(PluginUpdateAllResult, self.plugin_update_all_result) result["PluginUpdateResult"] = to_class(PluginUpdateResult, self.plugin_update_result) result["PollSpawnedSessionsResult"] = to_class(PollSpawnedSessionsResult, self.poll_spawned_sessions_result) result["ProviderAddRequest"] = to_class(ProviderAddRequest, self.provider_add_request) result["ProviderAddResult"] = to_class(ProviderAddResult, self.provider_add_result) result["ProviderConfig"] = to_class(ProviderConfig, self.provider_config) result["ProviderConfigAzure"] = to_class(ProviderConfigAzure, self.provider_config_azure) result["ProviderConfigTransport"] = to_enum(ProviderTransport, self.provider_config_transport) result["ProviderConfigType"] = to_enum(ProviderType, self.provider_config_type) result["ProviderConfigWireApi"] = to_enum(ProviderWireAPI, self.provider_config_wire_api) result["ProviderEndpoint"] = to_class(ProviderEndpoint, self.provider_endpoint) result["ProviderEndpointTransport"] = to_enum(ProviderTransport, self.provider_endpoint_transport) result["ProviderEndpointType"] = to_enum(ProviderType, self.provider_endpoint_type) result["ProviderEndpointWireApi"] = to_enum(ProviderWireAPI, self.provider_endpoint_wire_api) result["ProviderGetEndpointRequest"] = to_class(ProviderGetEndpointRequest, self.provider_get_endpoint_request) result["ProviderModelConfig"] = to_class(ProviderModelConfig, self.provider_model_config) result["ProviderSessionToken"] = to_class(ProviderSessionToken, self.provider_session_token) result["ProviderTokenAcquireRequest"] = to_class(ProviderTokenAcquireRequest, self.provider_token_acquire_request) result["ProviderTokenAcquireResult"] = to_class(ProviderTokenAcquireResult, self.provider_token_acquire_result) result["PushAttachment"] = (self.push_attachment).to_dict() result["PushAttachmentBlob"] = to_class(PushAttachmentBlob, self.push_attachment_blob) result["PushAttachmentDirectory"] = to_class(PushAttachmentDirectory, self.push_attachment_directory) result["PushAttachmentFile"] = to_class(PushAttachmentFile, self.push_attachment_file) result["PushAttachmentFileLineRange"] = to_class(PushAttachmentFileLineRange, self.push_attachment_file_line_range) result["PushAttachmentGitHubActionsJob"] = to_class(PushAttachmentGitHubActionsJob, self.push_attachment_git_hub_actions_job) result["PushAttachmentGitHubCommit"] = to_class(PushAttachmentGitHubCommit, self.push_attachment_git_hub_commit) result["PushAttachmentGitHubFile"] = to_class(PushAttachmentGitHubFile, self.push_attachment_git_hub_file) result["PushAttachmentGitHubFileDiff"] = to_class(PushAttachmentGitHubFileDiff, self.push_attachment_git_hub_file_diff) result["PushAttachmentGitHubFileDiffSide"] = to_class(PushAttachmentGitHubFileDiffSide, self.push_attachment_git_hub_file_diff_side) result["PushAttachmentGitHubReference"] = to_class(PushAttachmentGitHubReference, self.push_attachment_git_hub_reference) result["PushAttachmentGitHubReferenceType"] = to_enum(PushAttachmentGitHubReferenceTypeEnum, self.push_attachment_git_hub_reference_type) result["PushAttachmentGitHubRelease"] = to_class(PushAttachmentGitHubRelease, self.push_attachment_git_hub_release) result["PushAttachmentGitHubRepository"] = to_class(PushAttachmentGitHubRepository, self.push_attachment_git_hub_repository) result["PushAttachmentGitHubSnippet"] = to_class(PushAttachmentGitHubSnippet, self.push_attachment_git_hub_snippet) result["PushAttachmentGitHubTreeComparison"] = to_class(PushAttachmentGitHubTreeComparison, self.push_attachment_git_hub_tree_comparison) result["PushAttachmentGitHubTreeComparisonSide"] = to_class(PushAttachmentGitHubTreeComparisonSide, self.push_attachment_git_hub_tree_comparison_side) result["PushAttachmentGitHubUrl"] = to_class(PushAttachmentGitHubURL, self.push_attachment_git_hub_url) result["PushAttachmentSelection"] = to_class(PushAttachmentSelection, self.push_attachment_selection) result["PushAttachmentSelectionDetails"] = to_class(PushAttachmentSelectionDetails, self.push_attachment_selection_details) result["PushAttachmentSelectionDetailsEnd"] = to_class(PushAttachmentSelectionDetailsEnd, self.push_attachment_selection_details_end) result["PushAttachmentSelectionDetailsStart"] = to_class(PushAttachmentSelectionDetailsStart, self.push_attachment_selection_details_start) result["PushGitHubRepoRef"] = to_class(PushGitHubRepoRef, self.push_git_hub_repo_ref) result["QueuedCommandHandled"] = to_class(QueuedCommandHandled, self.queued_command_handled) result["QueuedCommandNotHandled"] = to_class(QueuedCommandNotHandled, self.queued_command_not_handled) result["QueuedCommandResult"] = (self.queued_command_result).to_dict() result["QueuePendingItems"] = to_class(QueuePendingItems, self.queue_pending_items) result["QueuePendingItemsKind"] = to_enum(QueuePendingItemsKind, self.queue_pending_items_kind) result["QueuePendingItemsResult"] = to_class(QueuePendingItemsResult, self.queue_pending_items_result) result["QueueRemoveMostRecentResult"] = to_class(QueueRemoveMostRecentResult, self.queue_remove_most_recent_result) result["RegisterEventInterestParams"] = to_class(RegisterEventInterestParams, self.register_event_interest_params) result["RegisterEventInterestResult"] = to_class(RegisterEventInterestResult, self.register_event_interest_result) result["RegisterExtensionToolsParams"] = to_class(_RegisterExtensionToolsParams, self.register_extension_tools_params) result["RegisterExtensionToolsResult"] = to_class(_RegisterExtensionToolsResult, self.register_extension_tools_result) result["ReleaseEventInterestParams"] = to_class(ReleaseEventInterestParams, self.release_event_interest_params) result["RemoteControlConfig"] = to_class(RemoteControlConfig, self.remote_control_config) result["RemoteControlConfigExistingMcSession"] = to_class(RemoteControlConfigExistingMcSession, self.remote_control_config_existing_mc_session) result["RemoteControlStatus"] = (self.remote_control_status).to_dict() result["RemoteControlStatusActive"] = to_class(RemoteControlStatusActive, self.remote_control_status_active) result["RemoteControlStatusConnecting"] = to_class(RemoteControlStatusConnecting, self.remote_control_status_connecting) result["RemoteControlStatusError"] = to_class(RemoteControlStatusError, self.remote_control_status_error) result["RemoteControlStatusOff"] = to_class(RemoteControlStatusOff, self.remote_control_status_off) result["RemoteControlStatusResult"] = to_class(RemoteControlStatusResult, self.remote_control_status_result) result["RemoteControlStopResult"] = to_class(RemoteControlStopResult, self.remote_control_stop_result) result["RemoteControlTransferResult"] = to_class(RemoteControlTransferResult, self.remote_control_transfer_result) result["RemoteEnableRequest"] = to_class(RemoteEnableRequest, self.remote_enable_request) result["RemoteEnableResult"] = to_class(RemoteEnableResult, self.remote_enable_result) result["RemoteNotifySteerableChangedRequest"] = to_class(RemoteNotifySteerableChangedRequest, self.remote_notify_steerable_changed_request) result["RemoteNotifySteerableChangedResult"] = to_class(RemoteNotifySteerableChangedResult, self.remote_notify_steerable_changed_result) result["RemoteSessionConnectionResult"] = to_class(RemoteSessionConnectionResult, self.remote_session_connection_result) result["RemoteSessionMetadataRepository"] = to_class(RemoteSessionMetadataRepository, self.remote_session_metadata_repository) result["RemoteSessionMetadataTaskType"] = to_enum(TaskType, self.remote_session_metadata_task_type) result["RemoteSessionMetadataValue"] = to_class(RemoteSessionMetadataValue, self.remote_session_metadata_value) result["RemoteSessionMode"] = to_enum(RemoteSessionMode, self.remote_session_mode) result["RemoteSessionRepository"] = to_class(RemoteSessionRepository, self.remote_session_repository) result["SandboxConfig"] = to_class(SandboxConfig, self.sandbox_config) result["SandboxConfigUserPolicy"] = to_class(SandboxConfigUserPolicy, self.sandbox_config_user_policy) result["SandboxConfigUserPolicyExperimental"] = to_class(SandboxConfigUserPolicyExperimental, self.sandbox_config_user_policy_experimental) result["SandboxConfigUserPolicyExperimentalSeatbelt"] = to_class(SandboxConfigUserPolicyExperimentalSeatbelt, self.sandbox_config_user_policy_experimental_seatbelt) result["SandboxConfigUserPolicyFilesystem"] = to_class(SandboxConfigUserPolicyFilesystem, self.sandbox_config_user_policy_filesystem) result["SandboxConfigUserPolicyNetwork"] = to_class(SandboxConfigUserPolicyNetwork, self.sandbox_config_user_policy_network) result["SandboxConfigUserPolicySeatbelt"] = to_class(SandboxConfigUserPolicySeatbelt, self.sandbox_config_user_policy_seatbelt) result["ScheduleEntry"] = to_class(ScheduleEntry, self.schedule_entry) result["ScheduleList"] = to_class(ScheduleList, self.schedule_list) result["ScheduleStopRequest"] = to_class(ScheduleStopRequest, self.schedule_stop_request) result["ScheduleStopResult"] = to_class(ScheduleStopResult, self.schedule_stop_result) result["SecretsAddFilterValuesRequest"] = to_class(SecretsAddFilterValuesRequest, self.secrets_add_filter_values_request) result["SecretsAddFilterValuesResult"] = to_class(SecretsAddFilterValuesResult, self.secrets_add_filter_values_result) result["SendAgentMode"] = to_enum(SendAgentMode, self.send_agent_mode) result["SendAttachmentsToMessageParams"] = to_class(SendAttachmentsToMessageParams, self.send_attachments_to_message_params) result["SendMode"] = to_enum(SendMode, self.send_mode) result["SendRequest"] = to_class(SendRequest, self.send_request) result["SendResult"] = to_class(SendResult, self.send_result) result["ServerAgentList"] = to_class(ServerAgentList, self.server_agent_list) result["ServerInstructionSourceList"] = to_class(ServerInstructionSourceList, self.server_instruction_source_list) result["ServerSkill"] = to_class(ServerSkill, self.server_skill) result["ServerSkillList"] = to_class(ServerSkillList, self.server_skill_list) result["SessionActivity"] = to_class(SessionActivity, self.session_activity) result["SessionAuthStatus"] = to_class(SessionAuthStatus, self.session_auth_status) result["SessionBulkDeleteResult"] = to_class(SessionBulkDeleteResult, self.session_bulk_delete_result) result["SessionCapability"] = to_enum(SessionCapability, self.session_capability) result["SessionCompletionItem"] = to_class(SessionCompletionItem, self.session_completion_item) result["SessionContext"] = to_class(SessionContext, self.session_context) result["SessionContextHostType"] = to_enum(HostType, self.session_context_host_type) result["SessionEnrichMetadataResult"] = to_class(SessionEnrichMetadataResult, self.session_enrich_metadata_result) result["SessionFsAppendFileRequest"] = to_class(SessionFSAppendFileRequest, self.session_fs_append_file_request) result["SessionFsError"] = to_class(SessionFSError, self.session_fs_error) result["SessionFsErrorCode"] = to_enum(SessionFSErrorCode, self.session_fs_error_code) result["SessionFsExistsRequest"] = to_class(SessionFSExistsRequest, self.session_fs_exists_request) result["SessionFsExistsResult"] = to_class(SessionFSExistsResult, self.session_fs_exists_result) result["SessionFsMkdirRequest"] = to_class(SessionFSMkdirRequest, self.session_fs_mkdir_request) result["SessionFsReaddirRequest"] = to_class(SessionFSReaddirRequest, self.session_fs_readdir_request) result["SessionFsReaddirResult"] = to_class(SessionFSReaddirResult, self.session_fs_readdir_result) result["SessionFsReaddirWithTypesEntry"] = to_class(SessionFSReaddirWithTypesEntry, self.session_fs_readdir_with_types_entry) result["SessionFsReaddirWithTypesEntryType"] = to_enum(InstructionDiscoveryPathKind, self.session_fs_readdir_with_types_entry_type) result["SessionFsReaddirWithTypesRequest"] = to_class(SessionFSReaddirWithTypesRequest, self.session_fs_readdir_with_types_request) result["SessionFsReaddirWithTypesResult"] = to_class(SessionFSReaddirWithTypesResult, self.session_fs_readdir_with_types_result) result["SessionFsReadFileRequest"] = to_class(SessionFSReadFileRequest, self.session_fs_read_file_request) result["SessionFsReadFileResult"] = to_class(SessionFSReadFileResult, self.session_fs_read_file_result) result["SessionFsRenameRequest"] = to_class(SessionFSRenameRequest, self.session_fs_rename_request) result["SessionFsRmRequest"] = to_class(SessionFSRmRequest, self.session_fs_rm_request) result["SessionFsSetProviderCapabilities"] = to_class(SessionFSSetProviderCapabilities, self.session_fs_set_provider_capabilities) result["SessionFsSetProviderConventions"] = to_enum(SessionFSSetProviderConventions, self.session_fs_set_provider_conventions) result["SessionFsSetProviderRequest"] = to_class(SessionFSSetProviderRequest, self.session_fs_set_provider_request) result["SessionFsSetProviderResult"] = to_class(SessionFSSetProviderResult, self.session_fs_set_provider_result) result["SessionFsSqliteExistsRequest"] = to_class(SessionFSSqliteExistsRequest, self.session_fs_sqlite_exists_request) result["SessionFsSqliteExistsResult"] = to_class(SessionFSSqliteExistsResult, self.session_fs_sqlite_exists_result) result["SessionFsSqliteQueryRequest"] = to_class(SessionFSSqliteQueryRequest, self.session_fs_sqlite_query_request) result["SessionFsSqliteQueryResult"] = to_class(SessionFSSqliteQueryResult, self.session_fs_sqlite_query_result) result["SessionFsSqliteQueryType"] = to_enum(SessionFSSqliteQueryType, self.session_fs_sqlite_query_type) result["SessionFsStatRequest"] = to_class(SessionFSStatRequest, self.session_fs_stat_request) result["SessionFsStatResult"] = to_class(SessionFSStatResult, self.session_fs_stat_result) result["SessionFsWriteFileRequest"] = to_class(SessionFSWriteFileRequest, self.session_fs_write_file_request) result["SessionInstalledPlugin"] = to_class(SessionInstalledPlugin, self.session_installed_plugin) result["SessionInstalledPluginSource"] = from_union([lambda x: to_class(SessionInstalledPluginSource, x), from_str], self.session_installed_plugin_source) result["SessionInstalledPluginSourceGitHub"] = to_class(SessionInstalledPluginSourceGitHub, self.session_installed_plugin_source_git_hub) result["SessionInstalledPluginSourceLocal"] = to_class(SessionInstalledPluginSourceLocal, self.session_installed_plugin_source_local) result["SessionInstalledPluginSourceUrl"] = to_class(SessionInstalledPluginSourceURL, self.session_installed_plugin_source_url) result["SessionList"] = to_class(SessionList, self.session_list) result["SessionListEntry"] = (self.session_list_entry).to_dict() result["SessionListFilter"] = to_class(SessionListFilter, self.session_list_filter) result["SessionLoadDeferredRepoHooksResult"] = to_class(SessionLoadDeferredRepoHooksResult, self.session_load_deferred_repo_hooks_result) result["SessionLogLevel"] = to_enum(SessionLogLevel, self.session_log_level) result["SessionMcpAppsCallToolResult"] = from_dict(lambda x: x, self.session_mcp_apps_call_tool_result) result["SessionMetadataSnapshot"] = to_class(SessionMetadataSnapshot, self.session_metadata_snapshot) result["SessionMode"] = to_enum(SessionMode, self.session_mode) result["SessionModelList"] = to_class(SessionModelList, self.session_model_list) result["SessionOpenOptions"] = to_class(SessionOpenOptions, self.session_open_options) result["SessionOpenOptionsAdditionalContentExclusionPolicy"] = to_class(SessionOpenOptionsAdditionalContentExclusionPolicy, self.session_open_options_additional_content_exclusion_policy) result["SessionOpenOptionsAdditionalContentExclusionPolicyRule"] = to_class(SessionOpenOptionsAdditionalContentExclusionPolicyRule, self.session_open_options_additional_content_exclusion_policy_rule) result["SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource"] = to_class(SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource, self.session_open_options_additional_content_exclusion_policy_rule_source) result["SessionOpenOptionsAdditionalContentExclusionPolicyScope"] = to_enum(AdditionalContentExclusionPolicyScope, self.session_open_options_additional_content_exclusion_policy_scope) result["SessionOpenOptionsEnvValueMode"] = to_enum(MCPSetEnvValueModeDetails, self.session_open_options_env_value_mode) result["SessionOpenOptionsReasoningSummary"] = to_enum(ReasoningSummary, self.session_open_options_reasoning_summary) result["SessionOpenParams"] = (self.session_open_params).to_dict() result["SessionOpenResult"] = to_class(SessionOpenResult, self.session_open_result) result["SessionPruneResult"] = to_class(SessionPruneResult, self.session_prune_result) result["SessionsBulkDeleteRequest"] = to_class(SessionsBulkDeleteRequest, self.sessions_bulk_delete_request) result["SessionsCheckInUseRequest"] = to_class(SessionsCheckInUseRequest, self.sessions_check_in_use_request) result["SessionsCheckInUseResult"] = to_class(SessionsCheckInUseResult, self.sessions_check_in_use_result) result["SessionsCloseRequest"] = to_class(SessionsCloseRequest, self.sessions_close_request) result["SessionsCloseResult"] = to_class(SessionsCloseResult, self.sessions_close_result) result["SessionsEnrichMetadataRequest"] = to_class(SessionsEnrichMetadataRequest, self.sessions_enrich_metadata_request) result["SessionSetCredentialsParams"] = to_class(SessionSetCredentialsParams, self.session_set_credentials_params) result["SessionSetCredentialsResult"] = to_class(SessionSetCredentialsResult, self.session_set_credentials_result) result["SessionsFindByPrefixRequest"] = to_class(SessionsFindByPrefixRequest, self.sessions_find_by_prefix_request) result["SessionsFindByPrefixResult"] = to_class(SessionsFindByPrefixResult, self.sessions_find_by_prefix_result) result["SessionsFindByTaskIDRequest"] = to_class(SessionsFindByTaskIDRequest, self.sessions_find_by_task_id_request) result["SessionsFindByTaskIDResult"] = to_class(SessionsFindByTaskIDResult, self.sessions_find_by_task_id_result) result["SessionsForkRequest"] = to_class(SessionsForkRequest, self.sessions_fork_request) result["SessionsForkResult"] = to_class(SessionsForkResult, self.sessions_fork_result) result["SessionsGetBoardEntryCountRequest"] = to_class(SessionsGetBoardEntryCountRequest, self.sessions_get_board_entry_count_request) result["SessionsGetBoardEntryCountResult"] = to_class(SessionsGetBoardEntryCountResult, self.sessions_get_board_entry_count_result) result["SessionsGetEventFilePathRequest"] = to_class(SessionsGetEventFilePathRequest, self.sessions_get_event_file_path_request) result["SessionsGetEventFilePathResult"] = to_class(SessionsGetEventFilePathResult, self.sessions_get_event_file_path_result) result["SessionsGetLastForContextRequest"] = to_class(SessionsGetLastForContextRequest, self.sessions_get_last_for_context_request) result["SessionsGetLastForContextResult"] = to_class(SessionsGetLastForContextResult, self.sessions_get_last_for_context_result) result["SessionsGetPersistedRemoteSteerableRequest"] = to_class(SessionsGetPersistedRemoteSteerableRequest, self.sessions_get_persisted_remote_steerable_request) result["SessionsGetPersistedRemoteSteerableResult"] = to_class(SessionsGetPersistedRemoteSteerableResult, self.sessions_get_persisted_remote_steerable_result) result["SessionSizes"] = to_class(SessionSizes, self.session_sizes) result["SessionsListRequest"] = to_class(SessionsListRequest, self.sessions_list_request) result["SessionsLoadDeferredRepoHooksRequest"] = to_class(SessionsLoadDeferredRepoHooksRequest, self.sessions_load_deferred_repo_hooks_request) result["SessionsOpenAttach"] = to_class(SessionsOpenAttach, self.sessions_open_attach) result["SessionsOpenCloud"] = to_class(SessionsOpenCloud, self.sessions_open_cloud) result["SessionsOpenCreate"] = to_class(SessionsOpenCreate, self.sessions_open_create) result["SessionsOpenHandoff"] = to_class(SessionsOpenHandoff, self.sessions_open_handoff) result["SessionsOpenHandoffTaskType"] = to_enum(TaskType, self.sessions_open_handoff_task_type) result["SessionsOpenProgress"] = to_class(SessionsOpenProgress, self.sessions_open_progress) result["SessionsOpenProgressStatus"] = to_enum(SessionsOpenProgressStatus, self.sessions_open_progress_status) result["SessionsOpenProgressStep"] = to_enum(SessionsOpenProgressStep, self.sessions_open_progress_step) result["SessionsOpenRemote"] = to_class(SessionsOpenRemote, self.sessions_open_remote) result["SessionsOpenResume"] = to_class(SessionsOpenResume, self.sessions_open_resume) result["SessionsOpenResumeLast"] = to_class(SessionsOpenResumeLast, self.sessions_open_resume_last) result["SessionsOpenStatus"] = to_enum(SessionsOpenStatus, self.sessions_open_status) result["SessionSource"] = to_enum(SessionSource, self.session_source) result["SessionsPollSpawnedSessionsEvent"] = to_class(SessionsPollSpawnedSessionsEvent, self.sessions_poll_spawned_sessions_event) result["SessionsPollSpawnedSessionsRequest"] = to_class(SessionsPollSpawnedSessionsRequest, self.sessions_poll_spawned_sessions_request) result["SessionsPruneOldRequest"] = to_class(SessionsPruneOldRequest, self.sessions_prune_old_request) result["SessionsRegisterExtensionToolsOnSessionOptions"] = to_class(SessionsRegisterExtensionToolsOnSessionOptions, self.sessions_register_extension_tools_on_session_options) result["SessionsReleaseLockRequest"] = to_class(SessionsReleaseLockRequest, self.sessions_release_lock_request) result["SessionsReleaseLockResult"] = to_class(SessionsReleaseLockResult, self.sessions_release_lock_result) result["SessionsReloadPluginHooksRequest"] = to_class(SessionsReloadPluginHooksRequest, self.sessions_reload_plugin_hooks_request) result["SessionsReloadPluginHooksResult"] = to_class(SessionsReloadPluginHooksResult, self.sessions_reload_plugin_hooks_result) result["SessionsSaveRequest"] = to_class(SessionsSaveRequest, self.sessions_save_request) result["SessionsSaveResult"] = to_class(SessionsSaveResult, self.sessions_save_result) result["SessionsSetAdditionalPluginsRequest"] = to_class(SessionsSetAdditionalPluginsRequest, self.sessions_set_additional_plugins_request) result["SessionsSetAdditionalPluginsResult"] = to_class(SessionsSetAdditionalPluginsResult, self.sessions_set_additional_plugins_result) result["SessionsSetRemoteControlSteeringRequest"] = to_class(SessionsSetRemoteControlSteeringRequest, self.sessions_set_remote_control_steering_request) result["SessionsStartRemoteControlRequest"] = to_class(SessionsStartRemoteControlRequest, self.sessions_start_remote_control_request) result["SessionsStopRemoteControlRequest"] = to_class(SessionsStopRemoteControlRequest, self.sessions_stop_remote_control_request) result["SessionsTransferRemoteControlRequest"] = to_class(SessionsTransferRemoteControlRequest, self.sessions_transfer_remote_control_request) result["SessionTelemetryEngagement"] = to_class(SessionTelemetryEngagement, self.session_telemetry_engagement) result["SessionUpdateOptionsParams"] = to_class(SessionUpdateOptionsParams, self.session_update_options_params) result["SessionUpdateOptionsResult"] = to_class(SessionUpdateOptionsResult, self.session_update_options_result) result["SessionVisibilityStatus"] = to_enum(SessionVisibilityStatus, self.session_visibility_status) result["SessionWorkingDirectoryContext"] = to_class(SessionWorkingDirectoryContext, self.session_working_directory_context) result["SessionWorkingDirectoryContextHostType"] = to_enum(HostType, self.session_working_directory_context_host_type) result["ShellCancelUserRequestedRequest"] = to_class(ShellCancelUserRequestedRequest, self.shell_cancel_user_requested_request) result["ShellExecRequest"] = to_class(ShellExecRequest, self.shell_exec_request) result["ShellExecResult"] = to_class(ShellExecResult, self.shell_exec_result) result["ShellExecuteUserRequestedRequest"] = to_class(ShellExecuteUserRequestedRequest, self.shell_execute_user_requested_request) result["ShellKillRequest"] = to_class(ShellKillRequest, self.shell_kill_request) result["ShellKillResult"] = to_class(ShellKillResult, self.shell_kill_result) result["ShellKillSignal"] = to_enum(ShellKillSignal, self.shell_kill_signal) result["ShutdownRequest"] = to_class(ShutdownRequest, self.shutdown_request) result["Skill"] = to_class(Skill, self.skill) result["SkillDiscoveryPath"] = to_class(SkillDiscoveryPath, self.skill_discovery_path) result["SkillDiscoveryPathList"] = to_class(SkillDiscoveryPathList, self.skill_discovery_path_list) result["SkillDiscoveryScope"] = to_enum(SkillDiscoveryScope, self.skill_discovery_scope) result["SkillList"] = to_class(SkillList, self.skill_list) result["SkillsConfigSetDisabledSkillsRequest"] = to_class(SkillsConfigSetDisabledSkillsRequest, self.skills_config_set_disabled_skills_request) result["SkillsDisableRequest"] = to_class(SkillsDisableRequest, self.skills_disable_request) result["SkillsDiscoverRequest"] = to_class(SkillsDiscoverRequest, self.skills_discover_request) result["SkillsEnableRequest"] = to_class(SkillsEnableRequest, self.skills_enable_request) result["SkillsGetDiscoveryPathsRequest"] = to_class(SkillsGetDiscoveryPathsRequest, self.skills_get_discovery_paths_request) result["SkillsGetInvokedResult"] = to_class(SkillsGetInvokedResult, self.skills_get_invoked_result) result["SkillsInvokedSkill"] = to_class(SkillsInvokedSkill, self.skills_invoked_skill) result["SkillsLoadDiagnostics"] = to_class(SkillsLoadDiagnostics, self.skills_load_diagnostics) result["SlashCommandAgentPromptResult"] = to_class(SlashCommandAgentPromptResult, self.slash_command_agent_prompt_result) result["SlashCommandCompletedResult"] = to_class(SlashCommandCompletedResult, self.slash_command_completed_result) result["SlashCommandInfo"] = to_class(SlashCommandInfo, self.slash_command_info) result["SlashCommandInput"] = to_class(SlashCommandInput, self.slash_command_input) result["SlashCommandInputCompletion"] = to_enum(SlashCommandInputCompletion, self.slash_command_input_completion) result["SlashCommandInvocationResult"] = (self.slash_command_invocation_result).to_dict() result["SlashCommandKind"] = to_enum(SlashCommandKind, self.slash_command_kind) result["SlashCommandSelectSubcommandOption"] = to_class(SlashCommandSelectSubcommandOption, self.slash_command_select_subcommand_option) result["SlashCommandSelectSubcommandResult"] = to_class(SlashCommandSelectSubcommandResult, self.slash_command_select_subcommand_result) result["SlashCommandTextResult"] = to_class(SlashCommandTextResult, self.slash_command_text_result) result["SubagentSettingsEntry"] = to_class(SubagentSettingsEntry, self.subagent_settings_entry) result["SubagentSettingsEntryContextTier"] = to_enum(SubagentSettingsEntryContextTier, self.subagent_settings_entry_context_tier) result["TaskAgentInfo"] = to_class(TaskAgentInfo, self.task_agent_info) result["TaskAgentProgress"] = to_class(TaskAgentProgress, self.task_agent_progress) result["TaskExecutionMode"] = to_enum(TaskExecutionMode, self.task_execution_mode) result["TaskInfo"] = (self.task_info).to_dict() result["TaskList"] = to_class(TaskList, self.task_list) result["TaskProgressLine"] = to_class(TaskProgressLine, self.task_progress_line) result["TasksCancelRequest"] = to_class(TasksCancelRequest, self.tasks_cancel_request) result["TasksCancelResult"] = to_class(TasksCancelResult, self.tasks_cancel_result) result["TasksGetCurrentPromotableResult"] = to_class(TasksGetCurrentPromotableResult, self.tasks_get_current_promotable_result) result["TasksGetProgressRequest"] = to_class(TasksGetProgressRequest, self.tasks_get_progress_request) result["TasksGetProgressResult"] = to_class(TasksGetProgressResult, self.tasks_get_progress_result) result["TaskShellInfo"] = to_class(TaskShellInfo, self.task_shell_info) result["TaskShellInfoAttachmentMode"] = to_enum(TaskShellInfoAttachmentMode, self.task_shell_info_attachment_mode) result["TaskShellProgress"] = to_class(TaskShellProgress, self.task_shell_progress) result["TasksPromoteCurrentToBackgroundResult"] = to_class(TasksPromoteCurrentToBackgroundResult, self.tasks_promote_current_to_background_result) result["TasksPromoteToBackgroundRequest"] = to_class(TasksPromoteToBackgroundRequest, self.tasks_promote_to_background_request) result["TasksPromoteToBackgroundResult"] = to_class(TasksPromoteToBackgroundResult, self.tasks_promote_to_background_result) result["TasksRefreshResult"] = to_class(TasksRefreshResult, self.tasks_refresh_result) result["TasksRemoveRequest"] = to_class(TasksRemoveRequest, self.tasks_remove_request) result["TasksRemoveResult"] = to_class(TasksRemoveResult, self.tasks_remove_result) result["TasksSendMessageRequest"] = to_class(TasksSendMessageRequest, self.tasks_send_message_request) result["TasksSendMessageResult"] = to_class(TasksSendMessageResult, self.tasks_send_message_result) result["TasksStartAgentRequest"] = to_class(TasksStartAgentRequest, self.tasks_start_agent_request) result["TasksStartAgentResult"] = to_class(TasksStartAgentResult, self.tasks_start_agent_result) result["TaskStatus"] = to_enum(TaskStatus, self.task_status) result["TasksWaitForPendingResult"] = to_class(TasksWaitForPendingResult, self.tasks_wait_for_pending_result) result["TelemetrySetFeatureOverridesRequest"] = to_class(TelemetrySetFeatureOverridesRequest, self.telemetry_set_feature_overrides_request) result["TokenAuthInfo"] = to_class(TokenAuthInfo, self.token_auth_info) result["Tool"] = to_class(Tool, self.tool) result["ToolList"] = to_class(ToolList, self.tool_list) result["ToolsGetCurrentMetadataResult"] = to_class(ToolsGetCurrentMetadataResult, self.tools_get_current_metadata_result) result["ToolsInitializeAndValidateResult"] = to_class(ToolsInitializeAndValidateResult, self.tools_initialize_and_validate_result) result["ToolsListRequest"] = to_class(ToolsListRequest, self.tools_list_request) result["ToolsUpdateSubagentSettingsResult"] = to_class(ToolsUpdateSubagentSettingsResult, self.tools_update_subagent_settings_result) result["UIAutoModeSwitchResponse"] = to_enum(UIAutoModeSwitchResponse, self.ui_auto_mode_switch_response) result["UIElicitationArrayAnyOfField"] = to_class(UIElicitationArrayAnyOfField, self.ui_elicitation_array_any_of_field) result["UIElicitationArrayAnyOfFieldItems"] = to_class(UIElicitationArrayAnyOfFieldItems, self.ui_elicitation_array_any_of_field_items) result["UIElicitationArrayAnyOfFieldItemsAnyOf"] = to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, self.ui_elicitation_array_any_of_field_items_any_of) result["UIElicitationArrayEnumField"] = to_class(UIElicitationArrayEnumField, self.ui_elicitation_array_enum_field) result["UIElicitationArrayEnumFieldItems"] = to_class(UIElicitationArrayEnumFieldItems, self.ui_elicitation_array_enum_field_items) result["UIElicitationFieldValue"] = from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], self.ui_elicitation_field_value) result["UIElicitationRequest"] = to_class(UIElicitationRequest, self.ui_elicitation_request) result["UIElicitationResponse"] = to_class(UIElicitationResponse, self.ui_elicitation_response) result["UIElicitationResponseAction"] = to_enum(UIElicitationResponseAction, self.ui_elicitation_response_action) result["UIElicitationResponseContent"] = from_dict(lambda x: from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], x), self.ui_elicitation_response_content) result["UIElicitationResult"] = to_class(UIElicitationResult, self.ui_elicitation_result) result["UIElicitationSchema"] = to_class(UIElicitationSchema, self.ui_elicitation_schema) result["UIElicitationSchemaProperty"] = to_class(UIElicitationSchemaProperty, self.ui_elicitation_schema_property) result["UIElicitationSchemaPropertyBoolean"] = to_class(UIElicitationSchemaPropertyBoolean, self.ui_elicitation_schema_property_boolean) result["UIElicitationSchemaPropertyNumber"] = to_class(UIElicitationSchemaPropertyNumber, self.ui_elicitation_schema_property_number) result["UIElicitationSchemaPropertyNumberType"] = to_enum(UIElicitationSchemaPropertyNumberType, self.ui_elicitation_schema_property_number_type) result["UIElicitationSchemaPropertyString"] = to_class(UIElicitationSchemaPropertyString, self.ui_elicitation_schema_property_string) result["UIElicitationSchemaPropertyStringFormat"] = to_enum(UIElicitationSchemaPropertyStringFormat, self.ui_elicitation_schema_property_string_format) result["UIElicitationStringEnumField"] = to_class(UIElicitationStringEnumField, self.ui_elicitation_string_enum_field) result["UIElicitationStringOneOfField"] = to_class(UIElicitationStringOneOfField, self.ui_elicitation_string_one_of_field) result["UIElicitationStringOneOfFieldOneOf"] = to_class(UIElicitationStringOneOfFieldOneOf, self.ui_elicitation_string_one_of_field_one_of) result["UIEphemeralQueryRequest"] = to_class(UIEphemeralQueryRequest, self.ui_ephemeral_query_request) result["UIEphemeralQueryResult"] = to_class(UIEphemeralQueryResult, self.ui_ephemeral_query_result) result["UIExitPlanModeAction"] = to_enum(UIExitPlanModeAction, self.ui_exit_plan_mode_action) result["UIExitPlanModeResponse"] = to_class(UIExitPlanModeResponse, self.ui_exit_plan_mode_response) result["UIHandlePendingAutoModeSwitchRequest"] = to_class(UIHandlePendingAutoModeSwitchRequest, self.ui_handle_pending_auto_mode_switch_request) result["UIHandlePendingElicitationRequest"] = to_class(UIHandlePendingElicitationRequest, self.ui_handle_pending_elicitation_request) result["UIHandlePendingExitPlanModeRequest"] = to_class(UIHandlePendingExitPlanModeRequest, self.ui_handle_pending_exit_plan_mode_request) result["UIHandlePendingResult"] = to_class(UIHandlePendingResult, self.ui_handle_pending_result) result["UIHandlePendingSamplingRequest"] = to_class(UIHandlePendingSamplingRequest, self.ui_handle_pending_sampling_request) result["UIHandlePendingSamplingResponse"] = from_dict(lambda x: x, self.ui_handle_pending_sampling_response) result["UIHandlePendingSessionLimitsExhaustedRequest"] = to_class(UIHandlePendingSessionLimitsExhaustedRequest, self.ui_handle_pending_session_limits_exhausted_request) result["UIHandlePendingUserInputRequest"] = to_class(UIHandlePendingUserInputRequest, self.ui_handle_pending_user_input_request) result["UIRegisterDirectAutoModeSwitchHandlerResult"] = to_class(UIRegisterDirectAutoModeSwitchHandlerResult, self.ui_register_direct_auto_mode_switch_handler_result) result["UISessionLimitsExhaustedResponse"] = to_class(UISessionLimitsExhaustedResponse, self.ui_session_limits_exhausted_response) result["UISessionLimitsExhaustedResponseAction"] = to_enum(UISessionLimitsExhaustedResponseAction, self.ui_session_limits_exhausted_response_action) result["UIUnregisterDirectAutoModeSwitchHandlerRequest"] = to_class(UIUnregisterDirectAutoModeSwitchHandlerRequest, self.ui_unregister_direct_auto_mode_switch_handler_request) result["UIUnregisterDirectAutoModeSwitchHandlerResult"] = to_class(UIUnregisterDirectAutoModeSwitchHandlerResult, self.ui_unregister_direct_auto_mode_switch_handler_result) result["UIUserInputResponse"] = to_class(UIUserInputResponse, self.ui_user_input_response) result["UpdateSubagentSettingsRequest"] = to_class(UpdateSubagentSettingsRequest, self.update_subagent_settings_request) result["UsageGetMetricsResult"] = to_class(UsageGetMetricsResult, self.usage_get_metrics_result) result["UsageMetricsCodeChanges"] = to_class(UsageMetricsCodeChanges, self.usage_metrics_code_changes) result["UsageMetricsModelMetric"] = to_class(UsageMetricsModelMetric, self.usage_metrics_model_metric) result["UsageMetricsModelMetricRequests"] = to_class(UsageMetricsModelMetricRequests, self.usage_metrics_model_metric_requests) result["UsageMetricsModelMetricTokenDetail"] = to_class(UsageMetricsModelMetricTokenDetail, self.usage_metrics_model_metric_token_detail) result["UsageMetricsModelMetricUsage"] = to_class(UsageMetricsModelMetricUsage, self.usage_metrics_model_metric_usage) result["UsageMetricsTokenDetail"] = to_class(UsageMetricsTokenDetail, self.usage_metrics_token_detail) result["UserAuthInfo"] = to_class(UserAuthInfo, self.user_auth_info) result["UserRequestedShellCommandResult"] = to_class(UserRequestedShellCommandResult, self.user_requested_shell_command_result) result["UserSettingMetadata"] = to_class(UserSettingMetadata, self.user_setting_metadata) result["UserSettingsGetResult"] = to_class(UserSettingsGetResult, self.user_settings_get_result) result["UserSettingsSetRequest"] = to_class(UserSettingsSetRequest, self.user_settings_set_request) result["UserSettingsSetResult"] = to_class(UserSettingsSetResult, self.user_settings_set_result) result["VisibilityGetResult"] = to_class(VisibilityGetResult, self.visibility_get_result) result["VisibilitySetRequest"] = to_class(VisibilitySetRequest, self.visibility_set_request) result["VisibilitySetResult"] = to_class(VisibilitySetResult, self.visibility_set_result) result["WorkspaceDiffFileChange"] = to_class(WorkspaceDiffFileChange, self.workspace_diff_file_change) result["WorkspaceDiffFileChangeType"] = to_enum(WorkspaceDiffFileChangeType, self.workspace_diff_file_change_type) result["WorkspaceDiffMode"] = to_enum(WorkspaceDiffMode, self.workspace_diff_mode) result["WorkspaceDiffResult"] = to_class(WorkspaceDiffResult, self.workspace_diff_result) result["WorkspacesCheckpoints"] = to_class(WorkspacesCheckpoints, self.workspaces_checkpoints) result["WorkspacesCreateFileRequest"] = to_class(WorkspacesCreateFileRequest, self.workspaces_create_file_request) result["WorkspacesDiffRequest"] = to_class(WorkspacesDiffRequest, self.workspaces_diff_request) result["WorkspacesGetWorkspaceResult"] = to_class(WorkspacesGetWorkspaceResult, self.workspaces_get_workspace_result) result["WorkspacesListCheckpointsResult"] = to_class(WorkspacesListCheckpointsResult, self.workspaces_list_checkpoints_result) result["WorkspacesListFilesResult"] = to_class(WorkspacesListFilesResult, self.workspaces_list_files_result) result["WorkspacesReadCheckpointRequest"] = to_class(WorkspacesReadCheckpointRequest, self.workspaces_read_checkpoint_request) result["WorkspacesReadCheckpointResult"] = to_class(WorkspacesReadCheckpointResult, self.workspaces_read_checkpoint_result) result["WorkspacesReadFileRequest"] = to_class(WorkspacesReadFileRequest, self.workspaces_read_file_request) result["WorkspacesReadFileResult"] = to_class(WorkspacesReadFileResult, self.workspaces_read_file_result) result["WorkspacesSaveLargePasteRequest"] = to_class(WorkspacesSaveLargePasteRequest, self.workspaces_save_large_paste_request) result["WorkspacesSaveLargePasteResult"] = to_class(WorkspacesSaveLargePasteResult, self.workspaces_save_large_paste_result) result["WorkspaceSummaryHostType"] = to_enum(HostType, self.workspace_summary_host_type) result["WorkspacesWorkspaceDetailsHostType"] = to_enum(HostType, self.workspaces_workspace_details_host_type) result["SessionContextInfo"] = from_union([lambda x: to_class(SessionContextInfo, x), from_none], self.session_context_info) result["SubagentSettings"] = from_union([lambda x: to_class(SubagentSettings, x), from_none], self.subagent_settings) result["TaskProgress"] = from_union([lambda x: to_class(TaskProgress, x), from_none], self.task_progress) result["WorkspaceSummary"] = from_union([lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace_summary) return result def rpc_from_dict(s: Any) -> RPC: return RPC.from_dict(s) def rpc_to_dict(x: RPC) -> Any: return to_class(RPC, x) # Outcome of an agentRegistry.spawn call. AgentRegistrySpawnResult = AgentRegistrySpawnSpawned | AgentRegistrySpawnError | AgentRegistrySpawnRegistryTimeout | AgentRegistrySpawnValidationError def _load_AgentRegistrySpawnResult(obj: Any) -> "AgentRegistrySpawnResult": assert isinstance(obj, dict) kind = obj.get("kind") match kind: case "spawned": return AgentRegistrySpawnSpawned.from_dict(obj) case "spawn-error": return AgentRegistrySpawnError.from_dict(obj) case "registry-timeout": return AgentRegistrySpawnRegistryTimeout.from_dict(obj) case "validation-error": return AgentRegistrySpawnValidationError.from_dict(obj) case _: raise ValueError(f"Unknown AgentRegistrySpawnResult kind: {kind!r}") # Initial authentication info for the session. AuthInfo = HMACAuthInfo | EnvAuthInfo | TokenAuthInfo | CopilotAPITokenAuthInfo | UserAuthInfo | GhCLIAuthInfo | APIKeyAuthInfo def _load_AuthInfo(obj: Any) -> "AuthInfo": assert isinstance(obj, dict) kind = obj.get("type") match kind: case "hmac": return HMACAuthInfo.from_dict(obj) case "env": return EnvAuthInfo.from_dict(obj) case "token": return TokenAuthInfo.from_dict(obj) case "copilot-api-token": return CopilotAPITokenAuthInfo.from_dict(obj) case "user": return UserAuthInfo.from_dict(obj) case "gh-cli": return GhCLIAuthInfo.from_dict(obj) case "api-key": return APIKeyAuthInfo.from_dict(obj) case _: raise ValueError(f"Unknown AuthInfo type: {kind!r}") # A content block within a tool result, which may be text, terminal output, image, audio, or a resource ExternalToolTextResultForLlmContent = ExternalToolTextResultForLlmContentText | ExternalToolTextResultForLlmContentTerminal | ExternalToolTextResultForLlmContentShellExit | ExternalToolTextResultForLlmContentImage | ExternalToolTextResultForLlmContentAudio | ExternalToolTextResultForLlmContentResourceLink | ExternalToolTextResultForLlmContentResource def _load_ExternalToolTextResultForLlmContent(obj: Any) -> "ExternalToolTextResultForLlmContent": assert isinstance(obj, dict) kind = obj.get("type") match kind: case "text": return ExternalToolTextResultForLlmContentText.from_dict(obj) case "terminal": return ExternalToolTextResultForLlmContentTerminal.from_dict(obj) case "shell_exit": return ExternalToolTextResultForLlmContentShellExit.from_dict(obj) case "image": return ExternalToolTextResultForLlmContentImage.from_dict(obj) case "audio": return ExternalToolTextResultForLlmContentAudio.from_dict(obj) case "resource_link": return ExternalToolTextResultForLlmContentResourceLink.from_dict(obj) case "resource": return ExternalToolTextResultForLlmContentResource.from_dict(obj) case _: raise ValueError(f"Unknown ExternalToolTextResultForLlmContent type: {kind!r}") # The client's response to the pending permission prompt PermissionDecision = PermissionDecisionApproveOnce | PermissionDecisionApproveForSession | PermissionDecisionApproveForLocation | PermissionDecisionApprovePermanently | PermissionDecisionReject | PermissionDecisionUserNotAvailable | PermissionDecisionApproved | PermissionDecisionApprovedForSession | PermissionDecisionApprovedForLocation | PermissionDecisionCancelled | PermissionDecisionDeniedByRules | PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser | PermissionDecisionDeniedInteractivelyByUser | PermissionDecisionDeniedByContentExclusionPolicy | PermissionDecisionDeniedByPermissionRequestHook def _load_PermissionDecision(obj: Any) -> "PermissionDecision": assert isinstance(obj, dict) kind = obj.get("kind") match kind: case "approve-once": return PermissionDecisionApproveOnce.from_dict(obj) case "approve-for-session": return PermissionDecisionApproveForSession.from_dict(obj) case "approve-for-location": return PermissionDecisionApproveForLocation.from_dict(obj) case "approve-permanently": return PermissionDecisionApprovePermanently.from_dict(obj) case "reject": return PermissionDecisionReject.from_dict(obj) case "user-not-available": return PermissionDecisionUserNotAvailable.from_dict(obj) case "approved": return PermissionDecisionApproved.from_dict(obj) case "approved-for-session": return PermissionDecisionApprovedForSession.from_dict(obj) case "approved-for-location": return PermissionDecisionApprovedForLocation.from_dict(obj) case "cancelled": return PermissionDecisionCancelled.from_dict(obj) case "denied-by-rules": return PermissionDecisionDeniedByRules.from_dict(obj) case "denied-no-approval-rule-and-could-not-request-from-user": return PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict(obj) case "denied-interactively-by-user": return PermissionDecisionDeniedInteractivelyByUser.from_dict(obj) case "denied-by-content-exclusion-policy": return PermissionDecisionDeniedByContentExclusionPolicy.from_dict(obj) case "denied-by-permission-request-hook": return PermissionDecisionDeniedByPermissionRequestHook.from_dict(obj) case _: raise ValueError(f"Unknown PermissionDecision kind: {kind!r}") # Approval to persist for this location PermissionDecisionApproveForLocationApproval = PermissionDecisionApproveForLocationApprovalCommands | PermissionDecisionApproveForLocationApprovalRead | PermissionDecisionApproveForLocationApprovalWrite | PermissionDecisionApproveForLocationApprovalMCP | PermissionDecisionApproveForLocationApprovalMCPSampling | PermissionDecisionApproveForLocationApprovalMemory | PermissionDecisionApproveForLocationApprovalCustomTool | PermissionDecisionApproveForLocationApprovalExtensionManagement | PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess def _load_PermissionDecisionApproveForLocationApproval(obj: Any) -> "PermissionDecisionApproveForLocationApproval": assert isinstance(obj, dict) kind = obj.get("kind") match kind: case "commands": return PermissionDecisionApproveForLocationApprovalCommands.from_dict(obj) case "read": return PermissionDecisionApproveForLocationApprovalRead.from_dict(obj) case "write": return PermissionDecisionApproveForLocationApprovalWrite.from_dict(obj) case "mcp": return PermissionDecisionApproveForLocationApprovalMCP.from_dict(obj) case "mcp-sampling": return PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict(obj) case "memory": return PermissionDecisionApproveForLocationApprovalMemory.from_dict(obj) case "custom-tool": return PermissionDecisionApproveForLocationApprovalCustomTool.from_dict(obj) case "extension-management": return PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict(obj) case "extension-permission-access": return PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict(obj) case _: raise ValueError(f"Unknown PermissionDecisionApproveForLocationApproval kind: {kind!r}") # Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) PermissionDecisionApproveForSessionApproval = PermissionDecisionApproveForSessionApprovalCommands | PermissionDecisionApproveForSessionApprovalRead | PermissionDecisionApproveForSessionApprovalWrite | PermissionDecisionApproveForSessionApprovalMCP | PermissionDecisionApproveForSessionApprovalMCPSampling | PermissionDecisionApproveForSessionApprovalMemory | PermissionDecisionApproveForSessionApprovalCustomTool | PermissionDecisionApproveForSessionApprovalExtensionManagement | PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess def _load_PermissionDecisionApproveForSessionApproval(obj: Any) -> "PermissionDecisionApproveForSessionApproval": assert isinstance(obj, dict) kind = obj.get("kind") match kind: case "commands": return PermissionDecisionApproveForSessionApprovalCommands.from_dict(obj) case "read": return PermissionDecisionApproveForSessionApprovalRead.from_dict(obj) case "write": return PermissionDecisionApproveForSessionApprovalWrite.from_dict(obj) case "mcp": return PermissionDecisionApproveForSessionApprovalMCP.from_dict(obj) case "mcp-sampling": return PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict(obj) case "memory": return PermissionDecisionApproveForSessionApprovalMemory.from_dict(obj) case "custom-tool": return PermissionDecisionApproveForSessionApprovalCustomTool.from_dict(obj) case "extension-management": return PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict(obj) case "extension-permission-access": return PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict(obj) case _: raise ValueError(f"Unknown PermissionDecisionApproveForSessionApproval kind: {kind!r}") # Tool approval to persist and apply PermissionsLocationsAddToolApprovalDetails = PermissionsLocationsAddToolApprovalDetailsCommands | PermissionsLocationsAddToolApprovalDetailsRead | PermissionsLocationsAddToolApprovalDetailsWrite | PermissionsLocationsAddToolApprovalDetailsMCP | PermissionsLocationsAddToolApprovalDetailsMCPSampling | PermissionsLocationsAddToolApprovalDetailsMemory | PermissionsLocationsAddToolApprovalDetailsCustomTool | PermissionsLocationsAddToolApprovalDetailsExtensionManagement | PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess def _load_PermissionsLocationsAddToolApprovalDetails(obj: Any) -> "PermissionsLocationsAddToolApprovalDetails": assert isinstance(obj, dict) kind = obj.get("kind") match kind: case "commands": return PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj) case "read": return PermissionsLocationsAddToolApprovalDetailsRead.from_dict(obj) case "write": return PermissionsLocationsAddToolApprovalDetailsWrite.from_dict(obj) case "mcp": return PermissionsLocationsAddToolApprovalDetailsMCP.from_dict(obj) case "mcp-sampling": return PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict(obj) case "memory": return PermissionsLocationsAddToolApprovalDetailsMemory.from_dict(obj) case "custom-tool": return PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj) case "extension-management": return PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict(obj) case "extension-permission-access": return PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict(obj) case _: raise ValueError(f"Unknown PermissionsLocationsAddToolApprovalDetails kind: {kind!r}") # Schema for the `PushAttachment` type. PushAttachment = PushAttachmentFile | PushAttachmentDirectory | PushAttachmentSelection | PushAttachmentGitHubReference | PushAttachmentGitHubCommit | PushAttachmentGitHubRelease | PushAttachmentGitHubActionsJob | PushAttachmentGitHubRepository | PushAttachmentGitHubFileDiff | PushAttachmentGitHubTreeComparison | PushAttachmentGitHubURL | PushAttachmentGitHubFile | PushAttachmentGitHubSnippet | PushAttachmentBlob | ExtensionContextPushInput def _load_PushAttachment(obj: Any) -> "PushAttachment": assert isinstance(obj, dict) kind = obj.get("type") match kind: case "file": return PushAttachmentFile.from_dict(obj) case "directory": return PushAttachmentDirectory.from_dict(obj) case "selection": return PushAttachmentSelection.from_dict(obj) case "github_reference": return PushAttachmentGitHubReference.from_dict(obj) case "github_commit": return PushAttachmentGitHubCommit.from_dict(obj) case "github_release": return PushAttachmentGitHubRelease.from_dict(obj) case "github_actions_job": return PushAttachmentGitHubActionsJob.from_dict(obj) case "github_repository": return PushAttachmentGitHubRepository.from_dict(obj) case "github_file_diff": return PushAttachmentGitHubFileDiff.from_dict(obj) case "github_tree_comparison": return PushAttachmentGitHubTreeComparison.from_dict(obj) case "github_url": return PushAttachmentGitHubURL.from_dict(obj) case "github_file": return PushAttachmentGitHubFile.from_dict(obj) case "github_snippet": return PushAttachmentGitHubSnippet.from_dict(obj) case "blob": return PushAttachmentBlob.from_dict(obj) case "extension_context": return ExtensionContextPushInput.from_dict(obj) case _: raise ValueError(f"Unknown PushAttachment type: {kind!r}") # Result of the queued command execution. QueuedCommandResult = QueuedCommandHandled | QueuedCommandNotHandled def _load_QueuedCommandResult(obj: Any) -> "QueuedCommandResult": assert isinstance(obj, dict) kind = obj.get("handled") match kind: case "true": return QueuedCommandHandled.from_dict(obj) case "false": return QueuedCommandNotHandled.from_dict(obj) case _: raise ValueError(f"Unknown QueuedCommandResult handled: {kind!r}") # State of the runtime-managed remote-control singleton. RemoteControlStatus = RemoteControlStatusOff | RemoteControlStatusConnecting | RemoteControlStatusActive | RemoteControlStatusError def _load_RemoteControlStatus(obj: Any) -> "RemoteControlStatus": assert isinstance(obj, dict) kind = obj.get("state") match kind: case "off": return RemoteControlStatusOff.from_dict(obj) case "connecting": return RemoteControlStatusConnecting.from_dict(obj) case "active": return RemoteControlStatusActive.from_dict(obj) case "error": return RemoteControlStatusError.from_dict(obj) case _: raise ValueError(f"Unknown RemoteControlStatus state: {kind!r}") # Local or remote session metadata entry. Narrow on `isRemote` to access source-specific fields. SessionListEntry = LocalSessionMetadataValue | RemoteSessionMetadataValue def _load_SessionListEntry(obj: Any) -> "SessionListEntry": assert isinstance(obj, dict) kind = obj.get("isRemote") match kind: case "false": return LocalSessionMetadataValue.from_dict(obj) case "true": return RemoteSessionMetadataValue.from_dict(obj) case _: raise ValueError(f"Unknown SessionListEntry isRemote: {kind!r}") # Open a session by creating, resuming, attaching, connecting to a remote, or handing off. SessionOpenParams = SessionsOpenCreate | SessionsOpenResume | SessionsOpenResumeLast | SessionsOpenAttach | SessionsOpenRemote | SessionsOpenCloud | SessionsOpenHandoff def _load_SessionOpenParams(obj: Any) -> "SessionOpenParams": assert isinstance(obj, dict) kind = obj.get("kind") match kind: case "create": return SessionsOpenCreate.from_dict(obj) case "resume": return SessionsOpenResume.from_dict(obj) case "resumeLast": return SessionsOpenResumeLast.from_dict(obj) case "attach": return SessionsOpenAttach.from_dict(obj) case "remote": return SessionsOpenRemote.from_dict(obj) case "cloud": return SessionsOpenCloud.from_dict(obj) case "handoff": return SessionsOpenHandoff.from_dict(obj) case _: raise ValueError(f"Unknown SessionOpenParams kind: {kind!r}") # Result of invoking the slash command (text output, prompt to send to the agent, completion, or subcommand selection). SlashCommandInvocationResult = SlashCommandTextResult | SlashCommandAgentPromptResult | SlashCommandCompletedResult | SlashCommandSelectSubcommandResult def _load_SlashCommandInvocationResult(obj: Any) -> "SlashCommandInvocationResult": assert isinstance(obj, dict) kind = obj.get("kind") match kind: case "text": return SlashCommandTextResult.from_dict(obj) case "agent-prompt": return SlashCommandAgentPromptResult.from_dict(obj) case "completed": return SlashCommandCompletedResult.from_dict(obj) case "select-subcommand": return SlashCommandSelectSubcommandResult.from_dict(obj) case _: raise ValueError(f"Unknown SlashCommandInvocationResult kind: {kind!r}") # Schema for the `TaskInfo` type. TaskInfo = TaskAgentInfo | TaskShellInfo def _load_TaskInfo(obj: Any) -> "TaskInfo": assert isinstance(obj, dict) kind = obj.get("type") match kind: case "agent": return TaskAgentInfo.from_dict(obj) case "shell": return TaskShellInfo.from_dict(obj) case _: raise ValueError(f"Unknown TaskInfo type: {kind!r}") AccountGetAllUsersResult = list CanvasActionInvokeResult = Any CanvasJsonSchema = Any ExternalToolResult = ExternalToolTextResultForLlm ExternalToolTextResultForLlmContentResourceLinkIconTheme = Theme FilterMapping = dict InstructionDiscoveryPathLocation = InstructionLocation InstructionSourceLocation = InstructionLocation LlmInferenceHeaders = dict McpAppsHostContextDetailsAvailableDisplayMode = MCPAppsDisplayMode McpAppsHostContextDetailsDisplayMode = MCPAppsDisplayMode McpAppsHostContextDetailsTheme = Theme McpAppsSetHostContextDetailsAvailableDisplayMode = MCPAppsDisplayMode McpAppsSetHostContextDetailsDisplayMode = MCPAppsDisplayMode McpAppsSetHostContextDetailsPlatform = MCPAppsHostContextDetailsPlatform McpAppsSetHostContextDetailsTheme = Theme McpExecuteSamplingRequest = dict McpExecuteSamplingResult = dict McpOauthLoginGrantType = MCPGrantType McpServerAuthConfig = bool McpServerConfigHttpOauthGrantType = MCPGrantType MetadataSnapshotRemoteMetadataTaskType = TaskType OptionsUpdateAdditionalContentExclusionPolicyScope = AdditionalContentExclusionPolicyScope OptionsUpdateEnvValueMode = MCPSetEnvValueModeDetails OptionsUpdateReasoningSummary = ReasoningSummary PermissionsConfigureAdditionalContentExclusionPolicyScope = AdditionalContentExclusionPolicyScope PermissionsSetAllowAllSource = PermissionsSetAAllSource PermissionsSetApproveAllSource = PermissionsSetAAllSource ProviderConfigTransport = ProviderTransport ProviderConfigType = ProviderType ProviderConfigWireApi = ProviderWireAPI ProviderEndpointTransport = ProviderTransport ProviderEndpointType = ProviderType ProviderEndpointWireApi = ProviderWireAPI RemoteSessionMetadataTaskType = TaskType SessionContextHostType = HostType SessionFsReaddirWithTypesEntryType = InstructionDiscoveryPathKind SessionMcpAppsCallToolResult = dict SessionOpenOptionsAdditionalContentExclusionPolicyScope = AdditionalContentExclusionPolicyScope SessionOpenOptionsEnvValueMode = MCPSetEnvValueModeDetails SessionOpenOptionsReasoningSummary = ReasoningSummary SessionsOpenHandoffTaskType = TaskType SessionWorkingDirectoryContextHostType = HostType TaskInfoExecutionMode = TaskExecutionMode TaskInfoStatus = TaskStatus WorkspaceSummaryHostType = HostType WorkspacesWorkspaceDetailsHostType = HostType def _timeout_kwargs(timeout: float | None) -> dict: """Build keyword arguments for optional timeout forwarding.""" if timeout is not None: return {"timeout": timeout} return {} def _patch_model_capabilities(data: dict) -> dict: """Ensure model capabilities have required fields. TODO: Remove once the runtime schema correctly marks these fields as optional. Some models (e.g. embedding models) may omit 'limits' or 'supports' in their capabilities, or omit 'max_context_window_tokens' within limits. The generated deserializer requires these fields, so we supply defaults here. """ for model in data.get("models", []): caps = model.get("capabilities") if caps is None: model["capabilities"] = {"supports": {}, "limits": {"max_context_window_tokens": 0}} continue if "supports" not in caps: caps["supports"] = {} if "limits" not in caps: caps["limits"] = {"max_context_window_tokens": 0} elif "max_context_window_tokens" not in caps["limits"]: caps["limits"]["max_context_window_tokens"] = 0 return data # Experimental: this API group is experimental and may change or be removed. class ServerModelsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def list(self, params: ModelsListRequest, *, timeout: float | None = None) -> ModelList: "Lists Copilot models available to the authenticated user.\n\nArgs:\n params: Optional GitHub token used to list models for a specific user instead of the global auth context.\n\nReturns:\n List of Copilot models available to the resolved user, including capabilities and billing metadata." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return ModelList.from_dict(_patch_model_capabilities(await self._client.request("models.list", params_dict, **_timeout_kwargs(timeout)))) # Experimental: this API group is experimental and may change or be removed. class ServerToolsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def list(self, params: ToolsListRequest, *, timeout: float | None = None) -> ToolList: "Lists built-in tools available for a model.\n\nArgs:\n params: Optional model identifier whose tool overrides should be applied to the listing.\n\nReturns:\n Built-in tools available for the requested model, with their parameters and instructions." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return ToolList.from_dict(await self._client.request("tools.list", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerAccountApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def get_quota(self, params: AccountGetQuotaRequest, *, timeout: float | None = None) -> AccountGetQuotaResult: "Gets Copilot quota usage for the authenticated user or supplied GitHub token.\n\nArgs:\n params: Optional GitHub token used to look up quota for a specific user instead of the global auth context.\n\nReturns:\n Quota usage snapshots for the resolved user, keyed by quota type." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return AccountGetQuotaResult.from_dict(await self._client.request("account.getQuota", params_dict, **_timeout_kwargs(timeout))) async def get_current_auth(self, *, timeout: float | None = None) -> AccountGetCurrentAuthResult: "Gets the currently active authentication credentials from the global auth manager.\n\nReturns:\n Current authentication state" return AccountGetCurrentAuthResult.from_dict(await self._client.request("account.getCurrentAuth", {}, **_timeout_kwargs(timeout))) async def get_all_users(self, *, timeout: float | None = None) -> list: "Gets all authenticated users available for account switching.\n\nReturns:\n List of all authenticated users" return list(await self._client.request("account.getAllUsers", {}, **_timeout_kwargs(timeout))) async def login(self, params: AccountLoginRequest, *, timeout: float | None = None) -> AccountLoginResult: "Stores authentication credentials after successful login (e.g., device code flow).\n\nArgs:\n params: Credentials to store after successful authentication\n\nReturns:\n Result of a successful login; throws on failure" params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return AccountLoginResult.from_dict(await self._client.request("account.login", params_dict, **_timeout_kwargs(timeout))) async def logout(self, params: AccountLogoutRequest, *, timeout: float | None = None) -> AccountLogoutResult: "Removes user authentication from keychain and persisted state.\n\nArgs:\n params: User to log out\n\nReturns:\n Logout result indicating if more users remain" params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return AccountLogoutResult.from_dict(await self._client.request("account.logout", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerSecretsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def add_filter_values(self, params: SecretsAddFilterValuesRequest, *, timeout: float | None = None) -> SecretsAddFilterValuesResult: "Registers secret values for redaction in session logs and exports. The SDK calls this to inject dynamically generated secret values (e.g., OIDC tokens).\n\nArgs:\n params: Secret values to add to the redaction filter.\n\nReturns:\n Confirmation that the secret values were registered." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SecretsAddFilterValuesResult.from_dict(await self._client.request("secrets.addFilterValues", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerMcpConfigApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def list(self, *, timeout: float | None = None) -> MCPConfigList: "Lists MCP servers from user configuration.\n\nReturns:\n User-configured MCP servers, keyed by server name." return MCPConfigList.from_dict(await self._client.request("mcp.config.list", {}, **_timeout_kwargs(timeout))) async def add(self, params: MCPConfigAddRequest, *, timeout: float | None = None) -> None: "Adds an MCP server to user configuration.\n\nArgs:\n params: MCP server name and configuration to add to user configuration." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.add", params_dict, **_timeout_kwargs(timeout)) async def update(self, params: MCPConfigUpdateRequest, *, timeout: float | None = None) -> None: "Updates an MCP server in user configuration.\n\nArgs:\n params: MCP server name and replacement configuration to write to user configuration." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.update", params_dict, **_timeout_kwargs(timeout)) async def remove(self, params: MCPConfigRemoveRequest, *, timeout: float | None = None) -> None: "Removes an MCP server from user configuration.\n\nArgs:\n params: MCP server name to remove from user configuration." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.remove", params_dict, **_timeout_kwargs(timeout)) async def enable(self, params: MCPConfigEnableRequest, *, timeout: float | None = None) -> None: "Enables MCP servers in user configuration for new sessions.\n\nArgs:\n params: MCP server names to enable for new sessions." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.enable", params_dict, **_timeout_kwargs(timeout)) async def disable(self, params: MCPConfigDisableRequest, *, timeout: float | None = None) -> None: "Disables MCP servers in user configuration for new sessions.\n\nArgs:\n params: MCP server names to disable for new sessions." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.disable", params_dict, **_timeout_kwargs(timeout)) async def reload(self, *, timeout: float | None = None) -> None: "Drops this runtime process's in-memory MCP server-definition cache so the next MCP config read observes disk." await self._client.request("mcp.config.reload", {}, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class ServerMcpApi: def __init__(self, client: "JsonRpcClient"): self._client = client self.config = ServerMcpConfigApi(client) async def discover(self, params: MCPDiscoverRequest, *, timeout: float | None = None) -> MCPDiscoverResult: "Discovers MCP servers from user, workspace, plugin, and builtin sources.\n\nArgs:\n params: Optional working directory used as context for MCP server discovery.\n\nReturns:\n MCP servers discovered from user, workspace, plugin, and built-in sources." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return MCPDiscoverResult.from_dict(await self._client.request("mcp.discover", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerPluginsMarketplacesApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def list(self, *, timeout: float | None = None) -> MarketplaceListResult: "Lists all registered marketplaces (defaults + user-added).\n\nReturns:\n All registered marketplaces, including built-in defaults." return MarketplaceListResult.from_dict(await self._client.request("plugins.marketplaces.list", {}, **_timeout_kwargs(timeout))) async def add(self, params: PluginsMarketplacesAddRequest, *, timeout: float | None = None) -> MarketplaceAddResult: "Registers a new marketplace from a source (owner/repo, URL, or local path).\n\nArgs:\n params: Marketplace source to register.\n\nReturns:\n Result of registering a new marketplace." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return MarketplaceAddResult.from_dict(await self._client.request("plugins.marketplaces.add", params_dict, **_timeout_kwargs(timeout))) async def remove(self, params: PluginsMarketplacesRemoveRequest, *, timeout: float | None = None) -> MarketplaceRemoveResult: "Removes a previously-registered marketplace. When the marketplace has dependent plugins and `force` is not set, the marketplace is left intact and the result lists the dependents so the caller can decide whether to retry with `force=true`.\n\nArgs:\n params: Name of the marketplace to remove and an optional force flag.\n\nReturns:\n Outcome of the remove attempt, including dependent-plugin info when applicable." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return MarketplaceRemoveResult.from_dict(await self._client.request("plugins.marketplaces.remove", params_dict, **_timeout_kwargs(timeout))) async def browse(self, params: PluginsMarketplacesBrowseRequest, *, timeout: float | None = None) -> MarketplaceBrowseResult: "Lists plugins advertised by a registered marketplace.\n\nArgs:\n params: Name of the marketplace whose plugin catalog to fetch.\n\nReturns:\n Plugins advertised by the marketplace." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return MarketplaceBrowseResult.from_dict(await self._client.request("plugins.marketplaces.browse", params_dict, **_timeout_kwargs(timeout))) async def refresh(self, params: PluginsMarketplacesRefreshRequest, *, timeout: float | None = None) -> MarketplaceRefreshResult: "Re-fetches one or all registered marketplace catalogs.\n\nArgs:\n params: Optional marketplace name; omit to refresh all.\n\nReturns:\n Result of refreshing one or more marketplace catalogs." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return MarketplaceRefreshResult.from_dict(await self._client.request("plugins.marketplaces.refresh", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerPluginsApi: def __init__(self, client: "JsonRpcClient"): self._client = client self.marketplaces = ServerPluginsMarketplacesApi(client) async def list(self, *, timeout: float | None = None) -> PluginListResult: "Lists plugins installed in user/global state.\n\nReturns:\n Plugins installed in user/global state." return PluginListResult.from_dict(await self._client.request("plugins.list", {}, **_timeout_kwargs(timeout))) async def install(self, params: PluginsInstallRequest, *, timeout: float | None = None) -> PluginInstallResult: "Installs a plugin from a marketplace, GitHub repo, URL, or local path.\n\nArgs:\n params: Plugin source and optional working directory for relative-path resolution.\n\nReturns:\n Result of installing a plugin." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return PluginInstallResult.from_dict(await self._client.request("plugins.install", params_dict, **_timeout_kwargs(timeout))) async def uninstall(self, params: PluginsUninstallRequest, *, timeout: float | None = None) -> None: "Uninstalls an installed plugin.\n\nArgs:\n params: Name (or spec) of the plugin to uninstall." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("plugins.uninstall", params_dict, **_timeout_kwargs(timeout)) async def update(self, params: PluginsUpdateRequest, *, timeout: float | None = None) -> PluginUpdateResult: "Updates an installed plugin to its latest published version.\n\nArgs:\n params: Name (or spec) of the plugin to update.\n\nReturns:\n Result of updating a single plugin." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return PluginUpdateResult.from_dict(await self._client.request("plugins.update", params_dict, **_timeout_kwargs(timeout))) async def update_all(self, *, timeout: float | None = None) -> PluginUpdateAllResult: "Updates every installed plugin to its latest published version.\n\nReturns:\n Result of updating all installed plugins." return PluginUpdateAllResult.from_dict(await self._client.request("plugins.updateAll", {}, **_timeout_kwargs(timeout))) async def enable(self, params: PluginsEnableRequest, *, timeout: float | None = None) -> None: "Enables installed plugins for new sessions.\n\nArgs:\n params: Plugin names (or specs) to enable." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("plugins.enable", params_dict, **_timeout_kwargs(timeout)) async def disable(self, params: PluginsDisableRequest, *, timeout: float | None = None) -> None: "Disables installed plugins for new sessions.\n\nArgs:\n params: Plugin names (or specs) to disable." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("plugins.disable", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class ServerSkillsConfigApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def set_disabled_skills(self, params: SkillsConfigSetDisabledSkillsRequest, *, timeout: float | None = None) -> None: "Replaces the global list of disabled skills.\n\nArgs:\n params: Skill names to mark as disabled in global configuration, replacing any previous list." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("skills.config.setDisabledSkills", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class ServerSkillsApi: def __init__(self, client: "JsonRpcClient"): self._client = client self.config = ServerSkillsConfigApi(client) async def discover(self, params: SkillsDiscoverRequest, *, timeout: float | None = None) -> ServerSkillList: "Discovers skills across global and project sources.\n\nArgs:\n params: Optional project paths and additional skill directories to include in discovery.\n\nReturns:\n Skills discovered across global and project sources." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return ServerSkillList.from_dict(await self._client.request("skills.discover", params_dict, **_timeout_kwargs(timeout))) async def get_discovery_paths(self, params: SkillsGetDiscoveryPathsRequest, *, timeout: float | None = None) -> SkillDiscoveryPathList: "Returns the canonical directories where a client may create skills that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.\n\nArgs:\n params: Optional project paths to enumerate.\n\nReturns:\n Canonical locations where skills can be created so the runtime will recognize them." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SkillDiscoveryPathList.from_dict(await self._client.request("skills.getDiscoveryPaths", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerAgentsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def discover(self, params: AgentsDiscoverRequest, *, timeout: float | None = None) -> ServerAgentList: "Discovers custom agents across user, project, plugin, and remote sources.\n\nArgs:\n params: Optional project paths to include in agent discovery.\n\nReturns:\n Agents discovered across user, project, plugin, and remote sources." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return ServerAgentList.from_dict(await self._client.request("agents.discover", params_dict, **_timeout_kwargs(timeout))) async def get_discovery_paths(self, params: AgentsGetDiscoveryPathsRequest, *, timeout: float | None = None) -> AgentDiscoveryPathList: "Returns the canonical directories where a client may create custom agents that the runtime will recognize, including ones that do not exist yet. Project directories become active once created.\n\nArgs:\n params: Optional project paths to include when enumerating agent discovery directories.\n\nReturns:\n Canonical locations where custom agents can be created so the runtime will recognize them." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return AgentDiscoveryPathList.from_dict(await self._client.request("agents.getDiscoveryPaths", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerInstructionsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def discover(self, params: InstructionsDiscoverRequest, *, timeout: float | None = None) -> ServerInstructionSourceList: "Discovers instruction sources across user, repository, and plugin sources.\n\nArgs:\n params: Optional project paths to include in instruction discovery.\n\nReturns:\n Instruction sources discovered across user, repository, and plugin sources." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return ServerInstructionSourceList.from_dict(await self._client.request("instructions.discover", params_dict, **_timeout_kwargs(timeout))) async def get_discovery_paths(self, params: InstructionsGetDiscoveryPathsRequest, *, timeout: float | None = None) -> InstructionDiscoveryPathList: "Returns the canonical files and directories where a client may create custom instructions that the runtime will recognize, including ones that do not exist yet. Repository targets become active once created.\n\nArgs:\n params: Optional project paths to include when enumerating instruction discovery targets.\n\nReturns:\n Canonical files and directories where custom instructions can be created so the runtime will recognize them." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return InstructionDiscoveryPathList.from_dict(await self._client.request("instructions.getDiscoveryPaths", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerUserSettingsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def reload(self, *, timeout: float | None = None) -> None: "Drops this runtime process's in-memory user settings cache so the next settings read observes disk." await self._client.request("user.settings.reload", {}, **_timeout_kwargs(timeout)) async def get(self, *, timeout: float | None = None) -> UserSettingsGetResult: "Lists every known user setting (settings.json overlaid with the legacy config.json, config.json wins), each with its effective value, its default, and whether it is at the default — so settings the user has never set still appear with their default value. Does not include repository- or enterprise-managed overrides that the runtime layers on top at session time.\n\nReturns:\n Per-key metadata for every known user setting (settings.json overlaid with the legacy config.json, config.json wins), including settings left at their default. Excludes repository- and enterprise-managed overrides." return UserSettingsGetResult.from_dict(await self._client.request("user.settings.get", {}, **_timeout_kwargs(timeout))) async def set(self, params: UserSettingsSetRequest, *, timeout: float | None = None) -> UserSettingsSetResult: "Writes one or more user settings to settings.json, replacing each provided top-level key. A key whose value is null is removed. Returns the keys whose new value is shadowed by a legacy config.json entry (config.json wins on read), which the runtime leaves in place — such writes do not take effect until the legacy value is removed.\n\nArgs:\n params: Partial user settings to write to settings.json. Each top-level key is written individually, replacing the existing value; a key whose value is null is removed.\n\nReturns:\n Outcome of writing user settings." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return UserSettingsSetResult.from_dict(await self._client.request("user.settings.set", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerUserApi: def __init__(self, client: "JsonRpcClient"): self._client = client self.settings = ServerUserSettingsApi(client) # Experimental: this API group is experimental and may change or be removed. class ServerRuntimeApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def shutdown(self, *, timeout: float | None = None) -> None: "Gracefully shuts down an SDK-owned runtime. The response is sent only after cleanup completes; callers may then terminate the owned runtime process." await self._client.request("runtime.shutdown", {}, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class ServerSessionFsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def set_provider(self, params: SessionFSSetProviderRequest, *, timeout: float | None = None) -> SessionFSSetProviderResult: "Registers an SDK client as the session filesystem provider.\n\nArgs:\n params: Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider.\n\nReturns:\n Indicates whether the calling client was registered as the session filesystem provider." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionFSSetProviderResult.from_dict(await self._client.request("sessionFs.setProvider", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerLlmInferenceApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def set_provider(self, *, timeout: float | None = None) -> LlmInferenceSetProviderResult: "Registers an SDK client as the LLM inference callback provider.\n\nReturns:\n Indicates whether the calling client was registered as the LLM inference provider." return LlmInferenceSetProviderResult.from_dict(await self._client.request("llmInference.setProvider", {}, **_timeout_kwargs(timeout))) async def http_response_start(self, params: LlmInferenceHTTPResponseStartRequest, *, timeout: float | None = None) -> LlmInferenceHTTPResponseStartResult: "Delivers the response head (status + headers) for an in-flight request, correlated by the requestId the runtime supplied in httpRequestStart. Must be called exactly once per request before any httpResponseChunk frames.\n\nArgs:\n params: Response head.\n\nReturns:\n Whether the start frame was accepted." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return LlmInferenceHTTPResponseStartResult.from_dict(await self._client.request("llmInference.httpResponseStart", params_dict, **_timeout_kwargs(timeout))) async def http_response_chunk(self, params: LlmInferenceHTTPResponseChunkRequest, *, timeout: float | None = None) -> LlmInferenceHTTPResponseChunkResult: "Delivers a body byte range (or a terminal transport error) for an in-flight response, correlated by requestId. Set `end` true on the last chunk. When `error` is set the response terminates with a transport-level failure and the runtime raises an APIConnectionError.\n\nArgs:\n params: A response body chunk or terminal error.\n\nReturns:\n Whether the chunk was accepted." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return LlmInferenceHTTPResponseChunkResult.from_dict(await self._client.request("llmInference.httpResponseChunk", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerSessionsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def open(self, params: SessionOpenParams, *, timeout: float | None = None) -> SessionOpenResult: "Creates or resumes a local session and returns the opened session ID.\n\nArgs:\n params: Open a session by creating, resuming, attaching, connecting to a remote, or handing off.\n\nReturns:\n Result of opening a session." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionOpenResult.from_dict(await self._client.request("sessions.open", params_dict, **_timeout_kwargs(timeout))) async def fork(self, params: SessionsForkRequest, *, timeout: float | None = None) -> SessionsForkResult: "Creates a new session by forking persisted history from an existing session.\n\nArgs:\n params: Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session.\n\nReturns:\n Identifier and optional friendly name assigned to the newly forked session." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsForkResult.from_dict(await self._client.request("sessions.fork", params_dict, **_timeout_kwargs(timeout))) async def connect(self, params: ConnectRemoteSessionParams, *, timeout: float | None = None) -> RemoteSessionConnectionResult: "Connects to an existing remote session and exposes it as an SDK session.\n\nArgs:\n params: Remote session connection parameters.\n\nReturns:\n Remote session connection result." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return RemoteSessionConnectionResult.from_dict(await self._client.request("sessions.connect", params_dict, **_timeout_kwargs(timeout))) async def list(self, params: SessionsListRequest, *, timeout: float | None = None) -> SessionList: "Lists sessions, optionally filtered by source and working-directory context. Returned entries are discriminated by `isRemote`: local entries carry only the lightweight `LocalSessionMetadataValue` shape; remote entries carry the full `RemoteSessionMetadataValue` shape (repository, PR number, taskType, etc.).\n\nArgs:\n params: Optional source filter, metadata-load limit, and context filter applied to the returned sessions.\n\nReturns:\n Sessions matching the filter, ordered most-recently-modified first." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionList.from_dict(await self._client.request("sessions.list", params_dict, **_timeout_kwargs(timeout))) async def find_by_task_id(self, params: SessionsFindByTaskIDRequest, *, timeout: float | None = None) -> SessionsFindByTaskIDResult: "Finds the local session bound to a GitHub task ID, if any.\n\nArgs:\n params: GitHub task ID to look up.\n\nReturns:\n ID of the local session bound to the given GitHub task, or omitted when none." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsFindByTaskIDResult.from_dict(await self._client.request("sessions.findByTaskId", params_dict, **_timeout_kwargs(timeout))) async def find_by_prefix(self, params: SessionsFindByPrefixRequest, *, timeout: float | None = None) -> SessionsFindByPrefixResult: "Resolves a UUID prefix to a unique session ID, if exactly one session matches.\n\nArgs:\n params: UUID prefix to resolve to a unique session ID.\n\nReturns:\n Session ID matching the prefix, omitted when no unique match exists." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsFindByPrefixResult.from_dict(await self._client.request("sessions.findByPrefix", params_dict, **_timeout_kwargs(timeout))) async def get_last_for_context(self, params: SessionsGetLastForContextRequest, *, timeout: float | None = None) -> SessionsGetLastForContextResult: "Returns the most-relevant prior session for a given working-directory context.\n\nArgs:\n params: Optional working-directory context used to score session relevance.\n\nReturns:\n Most-relevant session ID for the supplied context, or omitted when no sessions exist." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsGetLastForContextResult.from_dict(await self._client.request("sessions.getLastForContext", params_dict, **_timeout_kwargs(timeout))) async def get_sizes(self, *, timeout: float | None = None) -> SessionSizes: "Returns the on-disk byte size of each session's workspace directory.\n\nReturns:\n Map of sessionId -> on-disk size in bytes for each session's workspace directory." return SessionSizes.from_dict(await self._client.request("sessions.getSizes", {}, **_timeout_kwargs(timeout))) async def check_in_use(self, params: SessionsCheckInUseRequest, *, timeout: float | None = None) -> SessionsCheckInUseResult: "Returns the subset of the supplied session IDs that are currently held by another running process.\n\nArgs:\n params: Session IDs to test for live in-use locks.\n\nReturns:\n Session IDs from the input set that are currently in use by another process." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsCheckInUseResult.from_dict(await self._client.request("sessions.checkInUse", params_dict, **_timeout_kwargs(timeout))) async def close(self, params: SessionsCloseRequest, *, timeout: float | None = None) -> SessionsCloseResult: "Closes a session: emits shutdown, flushes pending events, releases the in-use lock, and disposes the active session.\n\nArgs:\n params: Session ID to close.\n\nReturns:\n Closes a session: emits shutdown, flushes pending events to disk, releases the in-use lock, disposes the active session. Idempotent: succeeds even if the session is not currently active." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsCloseResult.from_dict(await self._client.request("sessions.close", params_dict, **_timeout_kwargs(timeout))) async def bulk_delete(self, params: SessionsBulkDeleteRequest, *, timeout: float | None = None) -> SessionBulkDeleteResult: "Closes, deactivates, and deletes a set of sessions, returning the bytes freed per session.\n\nArgs:\n params: Session IDs to close, deactivate, and delete from disk.\n\nReturns:\n Map of sessionId -> bytes freed by removing the session's workspace directory." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionBulkDeleteResult.from_dict(await self._client.request("sessions.bulkDelete", params_dict, **_timeout_kwargs(timeout))) async def prune_old(self, params: SessionsPruneOldRequest, *, timeout: float | None = None) -> SessionPruneResult: "Deletes sessions older than the given threshold, with optional dry-run and exclusion list.\n\nArgs:\n params: Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true).\n\nReturns:\n Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionPruneResult.from_dict(await self._client.request("sessions.pruneOld", params_dict, **_timeout_kwargs(timeout))) async def save(self, params: SessionsSaveRequest, *, timeout: float | None = None) -> SessionsSaveResult: "Flushes a session's pending events to disk.\n\nArgs:\n params: Session ID whose pending events should be flushed to disk.\n\nReturns:\n Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed)." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsSaveResult.from_dict(await self._client.request("sessions.save", params_dict, **_timeout_kwargs(timeout))) async def release_lock(self, params: SessionsReleaseLockRequest, *, timeout: float | None = None) -> SessionsReleaseLockResult: "Releases the in-use lock held by this process for a session.\n\nArgs:\n params: Session ID whose in-use lock should be released.\n\nReturns:\n Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsReleaseLockResult.from_dict(await self._client.request("sessions.releaseLock", params_dict, **_timeout_kwargs(timeout))) async def enrich_metadata(self, params: SessionsEnrichMetadataRequest, *, timeout: float | None = None) -> SessionEnrichMetadataResult: "Backfills missing summary and context fields on the supplied session metadata records.\n\nArgs:\n params: Session metadata records to enrich with summary and context information.\n\nReturns:\n The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionEnrichMetadataResult.from_dict(await self._client.request("sessions.enrichMetadata", params_dict, **_timeout_kwargs(timeout))) async def reload_plugin_hooks(self, params: SessionsReloadPluginHooksRequest, *, timeout: float | None = None) -> SessionsReloadPluginHooksResult: "Reloads user, plugin, and (optionally) repo hooks on the active session.\n\nArgs:\n params: Active session ID and an optional flag for deferring repo-level hooks until folder trust.\n\nReturns:\n Reload all hooks (user, plugin, optionally repo) and apply them to the active session. Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsReloadPluginHooksResult.from_dict(await self._client.request("sessions.reloadPluginHooks", params_dict, **_timeout_kwargs(timeout))) async def load_deferred_repo_hooks(self, params: SessionsLoadDeferredRepoHooksRequest, *, timeout: float | None = None) -> SessionLoadDeferredRepoHooksResult: "Loads previously-deferred repo-level hooks on the active session, returning queued startup prompts.\n\nArgs:\n params: Active session ID whose deferred repo-level hooks should be loaded.\n\nReturns:\n Queued repo-level startup prompts and the total hook command count after loading." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionLoadDeferredRepoHooksResult.from_dict(await self._client.request("sessions.loadDeferredRepoHooks", params_dict, **_timeout_kwargs(timeout))) async def set_additional_plugins(self, params: SessionsSetAdditionalPluginsRequest, *, timeout: float | None = None) -> SessionsSetAdditionalPluginsResult: "Replaces the manager-wide additional plugins registered with the session manager.\n\nArgs:\n params: Manager-wide additional plugins to register; replaces any previously-configured set.\n\nReturns:\n Replace the manager-wide additional plugins. New session creations and subsequent hook reloads see the new set; already-running sessions keep their existing hook installation until the next reload." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsSetAdditionalPluginsResult.from_dict(await self._client.request("sessions.setAdditionalPlugins", params_dict, **_timeout_kwargs(timeout))) async def start_remote_control(self, params: SessionsStartRemoteControlRequest, *, timeout: float | None = None) -> RemoteControlStatusResult: "Attaches the runtime-managed remote-control singleton to a session, awaiting initial setup. If remote control is already attached to a different session, the singleton is transferred (preserving the underlying Mission Control connection). Returns the final status.\n\nArgs:\n params: Parameters for attaching the remote-control singleton to a session.\n\nReturns:\n Wrapper for the singleton's current status." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return RemoteControlStatusResult.from_dict(await self._client.request("sessions.startRemoteControl", params_dict, **_timeout_kwargs(timeout))) async def transfer_remote_control(self, params: SessionsTransferRemoteControlRequest, *, timeout: float | None = None) -> RemoteControlTransferResult: "Atomically rebinds the remote-control singleton to a different session, preserving the underlying Mission Control connection. When `expectedFromSessionId` is provided and does not match the singleton's current `attachedSessionId`, the transfer is rejected with `transferred: false` and the current status is returned unchanged.\n\nArgs:\n params: Parameters for atomically rebinding the remote-control singleton.\n\nReturns:\n Outcome of a transferRemoteControl call." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return RemoteControlTransferResult.from_dict(await self._client.request("sessions.transferRemoteControl", params_dict, **_timeout_kwargs(timeout))) async def set_remote_control_steering(self, params: SessionsSetRemoteControlSteeringRequest, *, timeout: float | None = None) -> RemoteControlStatusResult: "Patches the steering state of the active remote-control singleton. When remote control is off, this is a no-op and the off status is returned. Today only `enabled: true` is actionable on the underlying exporter; passing `false` is reserved for future use.\n\nArgs:\n params: Patch for the singleton's steering state.\n\nReturns:\n Wrapper for the singleton's current status." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return RemoteControlStatusResult.from_dict(await self._client.request("sessions.setRemoteControlSteering", params_dict, **_timeout_kwargs(timeout))) async def stop_remote_control(self, params: SessionsStopRemoteControlRequest, *, timeout: float | None = None) -> RemoteControlStopResult: "Stops the remote-control singleton. When `expectedSessionId` is provided and does not match the singleton's current `attachedSessionId`, the stop is rejected with `stopped: false` and the current status is returned unchanged (unless `force` is set, in which case the singleton is unconditionally torn down).\n\nArgs:\n params: Parameters for stopping the remote-control singleton.\n\nReturns:\n Outcome of a stopRemoteControl call." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return RemoteControlStopResult.from_dict(await self._client.request("sessions.stopRemoteControl", params_dict, **_timeout_kwargs(timeout))) async def get_remote_control_status(self, *, timeout: float | None = None) -> RemoteControlStatusResult: "Returns the current state of the remote-control singleton, including the attached session id and frontend URL when active.\n\nReturns:\n Wrapper for the singleton's current status." return RemoteControlStatusResult.from_dict(await self._client.request("sessions.getRemoteControlStatus", {}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ServerAgentRegistryApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def spawn(self, params: AgentRegistrySpawnRequest, *, timeout: float | None = None) -> AgentRegistrySpawnResult: "Spawns a managed-server child with the supplied configuration and returns a discriminated-union result. The caller (typically the CLI controller) is responsible for attaching to the spawned child and sending any follow-up prompt. When the controller-local spawn gate is closed the server returns JSON-RPC MethodNotFound.\n\nArgs:\n params: Inputs to spawn a managed-server child via the controller's spawn delegate.\n\nReturns:\n Outcome of an agentRegistry.spawn call." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return _load_AgentRegistrySpawnResult(await self._client.request("agentRegistry.spawn", params_dict, **_timeout_kwargs(timeout))) class ServerRpc: """Typed server-scoped RPC methods.""" def __init__(self, client: "JsonRpcClient"): self._client = client self.models = ServerModelsApi(client) self.tools = ServerToolsApi(client) self.account = ServerAccountApi(client) self.secrets = ServerSecretsApi(client) self.mcp = ServerMcpApi(client) self.plugins = ServerPluginsApi(client) self.skills = ServerSkillsApi(client) self.agents = ServerAgentsApi(client) self.instructions = ServerInstructionsApi(client) self.user = ServerUserApi(client) self.runtime = ServerRuntimeApi(client) self.session_fs = ServerSessionFsApi(client) self.llm_inference = ServerLlmInferenceApi(client) self.sessions = ServerSessionsApi(client) self.agent_registry = ServerAgentRegistryApi(client) async def ping(self, params: PingRequest, *, timeout: float | None = None) -> PingResult: "Checks server responsiveness and returns protocol information.\n\nArgs:\n params: Optional message to echo back to the caller.\n\nReturns:\n Server liveness response, including the echoed message, current server timestamp, and protocol version.\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return PingResult.from_dict(await self._client.request("ping", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class _InternalServerSessionsApi: def __init__(self, client: "JsonRpcClient"): self._client = client async def _get_event_file_path(self, params: SessionsGetEventFilePathRequest, *, timeout: float | None = None) -> SessionsGetEventFilePathResult: "Computes the absolute path to a session's persisted events.jsonl file. Internal: filesystem paths are only meaningful in-process (CLI and runtime share a filesystem). Currently used by the CLI's contribution-graph feature to read historical events directly. Remote SDK consumers must not depend on this; a proper event-query API would replace it if the contribution graph ever needed to work over the wire.\n\nArgs:\n params: Session ID whose event-log file path to compute.\n\nReturns:\n Absolute path to the session's events.jsonl file on disk.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsGetEventFilePathResult.from_dict(await self._client.request("sessions.getEventFilePath", params_dict, **_timeout_kwargs(timeout))) async def _get_persisted_remote_steerable(self, params: SessionsGetPersistedRemoteSteerableRequest, *, timeout: float | None = None) -> SessionsGetPersistedRemoteSteerableResult: "Returns a session's persisted remote-steerable flag, if any has been recorded. Internal: this is CLI-specific book-keeping used by `--continue` / `--resume` to inherit the prior session's remote-steerable preference. SDK consumers that want similar behavior should manage their own persistence around start/stop calls rather than relying on this runtime-side flag.\n\nArgs:\n params: Session ID to look up the persisted remote-steerable flag for.\n\nReturns:\n The session's persisted remote-steerable flag, or omitted when no value has been persisted.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsGetPersistedRemoteSteerableResult.from_dict(await self._client.request("sessions.getPersistedRemoteSteerable", params_dict, **_timeout_kwargs(timeout))) async def _get_board_entry_count(self, params: SessionsGetBoardEntryCountRequest, *, timeout: float | None = None) -> SessionsGetBoardEntryCountResult: "Gets the dynamic-context board entry count associated with a session, when available. Internal: this exists solely so CLI telemetry events (`rem_spawn_gate`, `rem_consolidation_complete`) can pair START / END board counts around the detached rem-agent spawn. \"Dynamic context board\" is a runtime-internal concept that is not part of the public SDK contract; the long-term plan is to relocate the telemetry emission into the runtime so this method can be deleted entirely.\n\nArgs:\n params: Session ID whose board entry count should be returned.\n\nReturns:\n Dynamic-context board entry count, when available.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionsGetBoardEntryCountResult.from_dict(await self._client.request("sessions.getBoardEntryCount", params_dict, **_timeout_kwargs(timeout))) async def _poll_spawned_sessions(self, params: SessionsPollSpawnedSessionsRequest, *, timeout: float | None = None) -> PollSpawnedSessionsResult: "Cursor-based long-poll for sessions spawned by the runtime (e.g. in response to a Mission Control `start_session` command). The cursor is an opaque token; pass it back to receive only spawn events that occurred AFTER the cursor was issued. Omit the cursor on the first call to receive any events buffered since the runtime started. Internal: this is a CLI background-daemon plumbing primitive. SDK consumers that need to react to runtime-spawned sessions should subscribe to a higher-level event stream rather than driving a long-poll loop.\n\nArgs:\n params: Cursor and optional long-poll wait for polling runtime-spawned sessions.\n\nReturns:\n Batch of spawn events plus a cursor for follow-up polls.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return PollSpawnedSessionsResult.from_dict(await self._client.request("sessions.pollSpawnedSessions", params_dict, **_timeout_kwargs(timeout))) async def _register_extension_tools_on_session(self, params: _RegisterExtensionToolsParams, *, timeout: float | None = None) -> _RegisterExtensionToolsResult: "Registers extension-provided tools on the given session, gated by an optional `enabled` callback. Returns an opaque unsubscribe function the caller must invoke to deregister the tools when the extension is torn down. Marked internal because `loader`, `enabled`, and the returned `unsubscribe` are in-process handles that cannot cross the JSON-RPC boundary. Disappears once extension discovery / launch / tool registration are owned by the runtime: SDK consumers will pass pure config (search paths, disabled ids) via `SessionOptions` and the runtime will resolve, launch, register, and tear down extensions itself.\n\nArgs:\n params: Params to attach an extension loader's tools to a session.\n\nReturns:\n Handle for releasing the extension tool registration.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return _RegisterExtensionToolsResult.from_dict(await self._client.request("sessions.registerExtensionToolsOnSession", params_dict, **_timeout_kwargs(timeout))) async def _configure_session_extensions(self, params: _ConfigureSessionExtensionsParams, *, timeout: float | None = None) -> None: "Attaches (or detaches) an in-process ExtensionController delegate for the given session, used by shared-API surfaces that need to query or modify the session's extension state. Pass `controller: undefined` to detach. Marked internal because the controller is an in-process object that cannot cross the JSON-RPC boundary. Disappears alongside `registerExtensionToolsOnSession`: once the runtime owns extension management, the public surface exposes list/enable/disable/reload as dedicated RPCs served by the runtime.\n\nArgs:\n params: Params to attach or detach an in-process ExtensionController delegate.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("sessions.configureSessionExtensions", params_dict, **_timeout_kwargs(timeout)) class _InternalServerRpc: """Internal SDK server-scoped RPC methods. Not part of the public API.""" def __init__(self, client: "JsonRpcClient"): self._client = client self.sessions = _InternalServerSessionsApi(client) async def _connect(self, params: _ConnectRequest, *, timeout: float | None = None) -> _ConnectResult: "Performs the SDK server connection handshake and validates the optional connection token. Marked internal because this is JSON-RPC transport plumbing invoked automatically by an SDK client's own `connect()` wrapper, not a user-facing method. Stays internal as long as the SDK client owns the handshake; would only become public if the SDK ever exposed the raw schema surface to consumers without a connection wrapper.\n\nArgs:\n params: Optional connection token presented by the SDK client during the handshake.\n\nReturns:\n Handshake result reporting the server's protocol version and package version on success.\n\n.. warning:: This API is experimental and may change or be removed in future versions.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return _ConnectResult.from_dict(await self._client.request("connect", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class GitHubAuthApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get_status(self, *, timeout: float | None = None) -> SessionAuthStatus: "Gets authentication status and account metadata for the session.\n\nReturns:\n Authentication status and account metadata for the session." return SessionAuthStatus.from_dict(await self._client.request("session.gitHubAuth.getStatus", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def set_credentials(self, params: SessionSetCredentialsParams, *, timeout: float | None = None) -> SessionSetCredentialsResult: "Updates the session's auth credentials used for outbound model and API requests.\n\nArgs:\n params: New auth credentials to install on the session. Omit to leave credentials unchanged.\n\nReturns:\n Indicates whether the credential update succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return SessionSetCredentialsResult.from_dict(await self._client.request("session.gitHubAuth.setCredentials", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class CanvasActionApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def invoke(self, params: CanvasActionInvokeRequest, *, timeout: float | None = None) -> Any: "Invokes an action on an open canvas instance.\n\nArgs:\n params: Canvas action invocation parameters.\n\nReturns:\n Canvas action invocation result." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return await self._client.request("session.canvas.action.invoke", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class CanvasApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id self.action = CanvasActionApi(client, session_id) async def list(self, *, timeout: float | None = None) -> CanvasList: "Lists canvases declared for the session.\n\nReturns:\n Declared canvases available in this session." return CanvasList.from_dict(await self._client.request("session.canvas.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def list_open(self, *, timeout: float | None = None) -> CanvasListOpenResult: "Lists currently open canvas instances for the live session.\n\nReturns:\n Live open-canvas snapshot." return CanvasListOpenResult.from_dict(await self._client.request("session.canvas.listOpen", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def open(self, params: CanvasOpenRequest, *, timeout: float | None = None) -> OpenCanvasInstance: "Opens or focuses a canvas instance.\n\nArgs:\n params: Canvas open parameters.\n\nReturns:\n Open canvas instance snapshot." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return OpenCanvasInstance.from_dict(await self._client.request("session.canvas.open", params_dict, **_timeout_kwargs(timeout))) async def close(self, params: CanvasCloseRequest, *, timeout: float | None = None) -> None: "Closes an open canvas instance.\n\nArgs:\n params: Canvas close parameters." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.canvas.close", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class ModelApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get_current(self, *, timeout: float | None = None) -> CurrentModel: "Gets the currently selected model for the session.\n\nReturns:\n The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume." return CurrentModel.from_dict(await self._client.request("session.model.getCurrent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def switch_to(self, params: ModelSwitchToRequest, *, timeout: float | None = None) -> ModelSwitchToResult: "Switches the session to a model and optional reasoning configuration.\n\nArgs:\n params: Target model identifier and optional reasoning effort, summary, capability overrides, and context tier.\n\nReturns:\n The model identifier active on the session after the switch." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return ModelSwitchToResult.from_dict(await self._client.request("session.model.switchTo", params_dict, **_timeout_kwargs(timeout))) async def set_reasoning_effort(self, params: ModelSetReasoningEffortRequest, *, timeout: float | None = None) -> ModelSetReasoningEffortResult: "Updates the session's reasoning effort without changing the selected model.\n\nArgs:\n params: Reasoning effort level to apply to the currently selected model.\n\nReturns:\n Update the session's reasoning effort without changing the selected model. Use `switchTo` instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return ModelSetReasoningEffortResult.from_dict(await self._client.request("session.model.setReasoningEffort", params_dict, **_timeout_kwargs(timeout))) async def list(self, params: ModelListRequest | None = None, *, timeout: float | None = None) -> SessionModelList: "Lists models available to this session using its own auth and integration context. Connected hosts (CLI TUI, GitHub App) should call this through the session client so remote sessions return the remote CLI's available models rather than the caller's.\n\nArgs:\n params: Optional listing options.\n\nReturns:\n The list of models available to this session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} params_dict["sessionId"] = self._session_id return SessionModelList.from_dict(await self._client.request("session.model.list", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ModeApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get(self, *, timeout: float | None = None) -> SessionMode: "Gets the current agent interaction mode.\n\nReturns:\n The session mode the agent is operating in" return SessionMode(await self._client.request("session.mode.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def set(self, params: ModeSetRequest, *, timeout: float | None = None) -> None: "Sets the current agent interaction mode.\n\nArgs:\n params: Agent interaction mode to apply to the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mode.set", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class NameApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get(self, *, timeout: float | None = None) -> NameGetResult: "Gets the session's friendly name.\n\nReturns:\n The session's friendly name, or null when not yet set." return NameGetResult.from_dict(await self._client.request("session.name.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def set(self, params: NameSetRequest, *, timeout: float | None = None) -> None: "Sets the session's friendly name.\n\nArgs:\n params: New friendly name to apply to the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.name.set", params_dict, **_timeout_kwargs(timeout)) async def set_auto(self, params: NameSetAutoRequest, *, timeout: float | None = None) -> NameSetAutoResult: "Persists an auto-generated session summary as the session's name when no user-set name exists.\n\nArgs:\n params: Auto-generated session summary to apply as the session's name when no user-set name exists.\n\nReturns:\n Indicates whether the auto-generated summary was applied as the session's name." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return NameSetAutoResult.from_dict(await self._client.request("session.name.setAuto", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class PlanApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def read(self, *, timeout: float | None = None) -> PlanReadResult: "Reads the session plan file from the workspace.\n\nReturns:\n Existence, contents, and resolved path of the session plan file." return PlanReadResult.from_dict(await self._client.request("session.plan.read", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def update(self, params: PlanUpdateRequest, *, timeout: float | None = None) -> None: "Writes new content to the session plan file.\n\nArgs:\n params: Replacement contents to write to the session plan file." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.plan.update", params_dict, **_timeout_kwargs(timeout)) async def delete(self, *, timeout: float | None = None) -> None: "Deletes the session plan file from the workspace." await self._client.request("session.plan.delete", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) async def read_sql_todos(self, *, timeout: float | None = None) -> PlanReadSQLTodosResult: "Reads todo rows from the session SQL database for plan rendering.\n\nReturns:\n Todo rows read from the session SQL database. Empty when no session database is available." return PlanReadSQLTodosResult.from_dict(await self._client.request("session.plan.readSqlTodos", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def read_sql_todos_with_dependencies(self, *, timeout: float | None = None) -> PlanReadSQLTodosWithDependenciesResult: "Reads todo rows AND dependency edges from the session SQL database for structured progress UI. Same defensive behavior as readSqlTodos — returns empty arrays when the database, tables, or columns aren't available. Clients should call this on session start and after every `session.todos_changed` event to refresh structured-UI rendering.\n\nReturns:\n Todo rows + dependency edges read from the session SQL database." return PlanReadSQLTodosWithDependenciesResult.from_dict(await self._client.request("session.plan.readSqlTodosWithDependencies", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class WorkspacesApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get_workspace(self, *, timeout: float | None = None) -> WorkspacesGetWorkspaceResult: "Gets current workspace metadata for the session.\n\nReturns:\n Current workspace metadata for the session, including its absolute filesystem path when available." return WorkspacesGetWorkspaceResult.from_dict(await self._client.request("session.workspaces.getWorkspace", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def list_files(self, *, timeout: float | None = None) -> WorkspacesListFilesResult: "Lists files stored in the session workspace files directory.\n\nReturns:\n Relative paths of files stored in the session workspace files directory." return WorkspacesListFilesResult.from_dict(await self._client.request("session.workspaces.listFiles", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def read_file(self, params: WorkspacesReadFileRequest, *, timeout: float | None = None) -> WorkspacesReadFileResult: "Reads a file from the session workspace files directory.\n\nArgs:\n params: Relative path of the workspace file to read.\n\nReturns:\n Contents of the requested workspace file as a UTF-8 string." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return WorkspacesReadFileResult.from_dict(await self._client.request("session.workspaces.readFile", params_dict, **_timeout_kwargs(timeout))) async def create_file(self, params: WorkspacesCreateFileRequest, *, timeout: float | None = None) -> None: "Creates or overwrites a file in the session workspace files directory.\n\nArgs:\n params: Relative path and UTF-8 content for the workspace file to create or overwrite." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.workspaces.createFile", params_dict, **_timeout_kwargs(timeout)) async def list_checkpoints(self, *, timeout: float | None = None) -> WorkspacesListCheckpointsResult: "Lists workspace checkpoints in chronological order.\n\nReturns:\n Workspace checkpoints in chronological order; empty when the workspace is not enabled." return WorkspacesListCheckpointsResult.from_dict(await self._client.request("session.workspaces.listCheckpoints", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def read_checkpoint(self, params: WorkspacesReadCheckpointRequest, *, timeout: float | None = None) -> WorkspacesReadCheckpointResult: "Reads the content of a workspace checkpoint by number.\n\nArgs:\n params: Checkpoint number to read.\n\nReturns:\n Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return WorkspacesReadCheckpointResult.from_dict(await self._client.request("session.workspaces.readCheckpoint", params_dict, **_timeout_kwargs(timeout))) async def save_large_paste(self, params: WorkspacesSaveLargePasteRequest, *, timeout: float | None = None) -> WorkspacesSaveLargePasteResult: "Saves pasted content as a UTF-8 file in the session workspace.\n\nArgs:\n params: Pasted content to save as a UTF-8 file in the session workspace.\n\nReturns:\n Descriptor for the saved paste file, or null when the workspace is unavailable." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return WorkspacesSaveLargePasteResult.from_dict(await self._client.request("session.workspaces.saveLargePaste", params_dict, **_timeout_kwargs(timeout))) async def diff(self, params: WorkspacesDiffRequest, *, timeout: float | None = None) -> WorkspaceDiffResult: "Computes a diff for the session workspace.\n\nArgs:\n params: Parameters for computing a workspace diff.\n\nReturns:\n Workspace diff result for the requested mode." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return WorkspaceDiffResult.from_dict(await self._client.request("session.workspaces.diff", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class CompletionsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get_trigger_characters(self, *, timeout: float | None = None) -> CompletionsGetTriggerCharactersResult: "Gets the characters that should trigger host-driven completions for the session. Empty disables host-driven completions (e.g. local sessions, or a relay host that does not advertise them).\n\nReturns:\n Characters that, when typed in the composer, should trigger a `completions.request`. Empty when the session has no host-driven completions (e.g. local sessions, or a relay host that does not advertise `completionTriggerCharacters`)." return CompletionsGetTriggerCharactersResult.from_dict(await self._client.request("session.completions.getTriggerCharacters", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def request(self, params: CompletionsRequestRequest, *, timeout: float | None = None) -> CompletionsRequestResult: "Requests host-driven completion items for the current composer input. Returns an empty list when the host has no items or does not support completions.\n\nArgs:\n params: Request host-driven completions for the current composer input.\n\nReturns:\n Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return CompletionsRequestResult.from_dict(await self._client.request("session.completions.request", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class InstructionsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get_sources(self, *, timeout: float | None = None) -> InstructionsGetSourcesResult: "Gets instruction sources loaded for the session.\n\nReturns:\n Instruction sources loaded for the session, in merge order." return InstructionsGetSourcesResult.from_dict(await self._client.request("session.instructions.getSources", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class FleetApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def start(self, params: FleetStartRequest, *, timeout: float | None = None) -> FleetStartResult: "Starts fleet mode by submitting the fleet orchestration prompt to the session.\n\nArgs:\n params: Optional user prompt to combine with the fleet orchestration instructions.\n\nReturns:\n Indicates whether fleet mode was successfully activated." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return FleetStartResult.from_dict(await self._client.request("session.fleet.start", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class AgentApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def list(self, *, timeout: float | None = None) -> AgentList: "Lists custom agents available to the session.\n\nReturns:\n Custom agents available to the session." return AgentList.from_dict(await self._client.request("session.agent.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def get_current(self, *, timeout: float | None = None) -> AgentGetCurrentResult: "Gets the currently selected custom agent for the session.\n\nReturns:\n The currently selected custom agent, or null when using the default agent." return AgentGetCurrentResult.from_dict(await self._client.request("session.agent.getCurrent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def select(self, params: AgentSelectRequest, *, timeout: float | None = None) -> AgentSelectResult: "Selects a custom agent for subsequent turns in the session.\n\nArgs:\n params: Name of the custom agent to select for subsequent turns.\n\nReturns:\n The newly selected custom agent." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return AgentSelectResult.from_dict(await self._client.request("session.agent.select", params_dict, **_timeout_kwargs(timeout))) async def deselect(self, *, timeout: float | None = None) -> None: "Clears the selected custom agent and returns the session to the default agent." await self._client.request("session.agent.deselect", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) async def reload(self, *, timeout: float | None = None) -> AgentReloadResult: "Reloads custom agent definitions and returns the refreshed list.\n\nReturns:\n Custom agents available to the session after reloading definitions from disk." return AgentReloadResult.from_dict(await self._client.request("session.agent.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class TasksApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def start_agent(self, params: TasksStartAgentRequest, *, timeout: float | None = None) -> TasksStartAgentResult: "Starts a background agent task in the session.\n\nArgs:\n params: Agent type, prompt, name, and optional description and model override for the new task.\n\nReturns:\n Identifier assigned to the newly started background agent task." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return TasksStartAgentResult.from_dict(await self._client.request("session.tasks.startAgent", params_dict, **_timeout_kwargs(timeout))) async def list(self, *, timeout: float | None = None) -> TaskList: "Lists background tasks tracked by the session.\n\nReturns:\n Background tasks currently tracked by the session." return TaskList.from_dict(await self._client.request("session.tasks.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def refresh(self, *, timeout: float | None = None) -> TasksRefreshResult: "Refreshes metadata for any detached background shells the runtime knows about.\n\nReturns:\n Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop." return TasksRefreshResult.from_dict(await self._client.request("session.tasks.refresh", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def wait_for_pending(self, *, timeout: float | None = None) -> TasksWaitForPendingResult: "Waits for all in-flight background tasks and any follow-up turns to settle.\n\nReturns:\n Wait until all in-flight background tasks (agents + shells) and any follow-up turns scheduled by their completions have settled. Returns when the runtime is fully drained or after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS)." return TasksWaitForPendingResult.from_dict(await self._client.request("session.tasks.waitForPending", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def get_progress(self, params: TasksGetProgressRequest, *, timeout: float | None = None) -> TasksGetProgressResult: "Returns progress information for a background task by ID.\n\nArgs:\n params: Identifier of the background task to fetch progress for.\n\nReturns:\n Progress information for the task, or null when no task with that ID is tracked." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return TasksGetProgressResult.from_dict(await self._client.request("session.tasks.getProgress", params_dict, **_timeout_kwargs(timeout))) async def get_current_promotable(self, *, timeout: float | None = None) -> TasksGetCurrentPromotableResult: "Returns the first sync-waiting task that can currently be promoted to background mode.\n\nReturns:\n The first sync-waiting task that can currently be promoted to background mode." return TasksGetCurrentPromotableResult.from_dict(await self._client.request("session.tasks.getCurrentPromotable", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def promote_to_background(self, params: TasksPromoteToBackgroundRequest, *, timeout: float | None = None) -> TasksPromoteToBackgroundResult: "Promotes an eligible synchronously-waited task so it continues running in the background.\n\nArgs:\n params: Identifier of the task to promote to background mode.\n\nReturns:\n Indicates whether the task was successfully promoted to background mode." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return TasksPromoteToBackgroundResult.from_dict(await self._client.request("session.tasks.promoteToBackground", params_dict, **_timeout_kwargs(timeout))) async def promote_current_to_background(self, *, timeout: float | None = None) -> TasksPromoteCurrentToBackgroundResult: "Atomically promotes the first promotable sync-waiting task to background mode and returns it.\n\nReturns:\n The promoted task as it now exists in background mode, omitted if no promotable task was waiting." return TasksPromoteCurrentToBackgroundResult.from_dict(await self._client.request("session.tasks.promoteCurrentToBackground", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def cancel(self, params: TasksCancelRequest, *, timeout: float | None = None) -> TasksCancelResult: "Cancels a background task.\n\nArgs:\n params: Identifier of the background task to cancel.\n\nReturns:\n Indicates whether the background task was successfully cancelled." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return TasksCancelResult.from_dict(await self._client.request("session.tasks.cancel", params_dict, **_timeout_kwargs(timeout))) async def remove(self, params: TasksRemoveRequest, *, timeout: float | None = None) -> TasksRemoveResult: "Removes a completed or cancelled background task from tracking.\n\nArgs:\n params: Identifier of the completed or cancelled task to remove from tracking.\n\nReturns:\n Indicates whether the task was removed. False when the task does not exist or is still running/idle." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return TasksRemoveResult.from_dict(await self._client.request("session.tasks.remove", params_dict, **_timeout_kwargs(timeout))) async def send_message(self, params: TasksSendMessageRequest, *, timeout: float | None = None) -> TasksSendMessageResult: "Sends a message to a background agent task.\n\nArgs:\n params: Identifier of the target agent task, message content, and optional sender agent ID.\n\nReturns:\n Indicates whether the message was delivered, with an error message when delivery failed." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return TasksSendMessageResult.from_dict(await self._client.request("session.tasks.sendMessage", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class SkillsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def list(self, *, timeout: float | None = None) -> SkillList: "Lists skills available to the session.\n\nReturns:\n Skills available to the session, with their enabled state." return SkillList.from_dict(await self._client.request("session.skills.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def get_invoked(self, *, timeout: float | None = None) -> SkillsGetInvokedResult: "Returns the skills that have been invoked during this session.\n\nReturns:\n Skills invoked during this session, ordered by invocation time (most recent last)." return SkillsGetInvokedResult.from_dict(await self._client.request("session.skills.getInvoked", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def enable(self, params: SkillsEnableRequest, *, timeout: float | None = None) -> None: "Enables a skill for the session.\n\nArgs:\n params: Name of the skill to enable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.skills.enable", params_dict, **_timeout_kwargs(timeout)) async def disable(self, params: SkillsDisableRequest, *, timeout: float | None = None) -> None: "Disables a skill for the session.\n\nArgs:\n params: Name of the skill to disable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.skills.disable", params_dict, **_timeout_kwargs(timeout)) async def reload(self, *, timeout: float | None = None) -> SkillsLoadDiagnostics: "Reloads skill definitions for the session.\n\nReturns:\n Diagnostics from reloading skill definitions, with warnings and errors as separate lists." return SkillsLoadDiagnostics.from_dict(await self._client.request("session.skills.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def ensure_loaded(self, *, timeout: float | None = None) -> None: "Ensures the session's skill definitions have been loaded from disk." await self._client.request("session.skills.ensureLoaded", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class McpOauthApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def handle_pending_request(self, params: MCPOauthHandlePendingRequest, *, timeout: float | None = None) -> MCPOauthHandlePendingResult: "Resolves a pending MCP OAuth request with a host-provided token or cancellation. The pending request is emitted as mcp.oauth_required with the data necessary to authorize the request.\n\nArgs:\n params: Pending MCP OAuth request ID and host-provided token or cancellation response.\n\nReturns:\n Indicates whether the pending MCP OAuth response was accepted." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPOauthHandlePendingResult.from_dict(await self._client.request("session.mcp.oauth.handlePendingRequest", params_dict, **_timeout_kwargs(timeout))) async def login(self, params: MCPOauthLoginRequest, *, timeout: float | None = None) -> MCPOauthLoginResult: "Starts OAuth authentication for a remote MCP server.\n\nArgs:\n params: Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection.\n\nReturns:\n OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPOauthLoginResult.from_dict(await self._client.request("session.mcp.oauth.login", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class McpHeadersApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def handle_pending_headers_refresh_request(self, params: MCPHeadersHandlePendingHeadersRefreshRequestRequest, *, timeout: float | None = None) -> MCPHeadersHandlePendingHeadersRefreshRequestResult: "Responds to a pending MCP dynamic headers refresh request. Hosts that subscribe to `mcp.headers_refresh_required` use this to provide short-lived per-server headers or to indicate that no dynamic headers are available for this refresh.\n\nArgs:\n params: MCP headers refresh request id and the host response.\n\nReturns:\n Indicates whether the pending MCP headers refresh response was accepted." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPHeadersHandlePendingHeadersRefreshRequestResult.from_dict(await self._client.request("session.mcp.headers.handlePendingHeadersRefreshRequest", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class McpAppsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def read_resource(self, params: MCPAppsReadResourceRequest, *, timeout: float | None = None) -> MCPAppsReadResourceResult: "Fetch an MCP resource (typically a `ui://` MCP App bundle, per SEP-1865) from a connected server. Requires the `mcp-apps` session capability.\n\nArgs:\n params: MCP server and resource URI to fetch.\n\nReturns:\n Resource contents returned by the MCP server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPAppsReadResourceResult.from_dict(await self._client.request("session.mcp.apps.readResource", params_dict, **_timeout_kwargs(timeout))) async def list_tools(self, params: MCPAppsListToolsRequest, *, timeout: float | None = None) -> MCPAppsListToolsResult: "List tools that an MCP App view is allowed to call (SEP-1865 visibility filter). Returns tools whose `_meta.ui.visibility` is unset (default `[\"model\",\"app\"]`) or includes `\"app\"`.\n\nArgs:\n params: MCP server to list app-callable tools for.\n\nReturns:\n App-callable tools from the named MCP server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPAppsListToolsResult.from_dict(await self._client.request("session.mcp.apps.listTools", params_dict, **_timeout_kwargs(timeout))) async def call_tool(self, params: MCPAppsCallToolRequest, *, timeout: float | None = None) -> dict: "Call an MCP tool from an MCP App view (SEP-1865). Enforces the visibility check that prevents an app iframe from invoking model-only tools. Returns the standard MCP `CallToolResult`.\n\nArgs:\n params: MCP server, tool name, and arguments to invoke from an MCP App view.\n\nReturns:\n Standard MCP CallToolResult" params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return dict(await self._client.request("session.mcp.apps.callTool", params_dict, **_timeout_kwargs(timeout))) async def set_host_context(self, params: MCPAppsSetHostContextRequest, *, timeout: float | None = None) -> None: "Replace the host context returned to MCP App guests on `ui/initialize`. Hosts use this to advertise theme, locale, or other metadata to the guest UI.\n\nArgs:\n params: Host context to advertise to MCP App guests." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mcp.apps.setHostContext", params_dict, **_timeout_kwargs(timeout)) async def get_host_context(self, *, timeout: float | None = None) -> MCPAppsHostContext: "Read the current host context advertised to MCP App guests.\n\nReturns:\n Current host context advertised to MCP App guests." return MCPAppsHostContext.from_dict(await self._client.request("session.mcp.apps.getHostContext", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def diagnose(self, params: MCPAppsDiagnoseRequest, *, timeout: float | None = None) -> MCPAppsDiagnoseResult: "Diagnose MCP Apps wiring for a specific MCP server. Reports the session capability, feature-flag state, advertised extension, and how many tools have `_meta.ui` populated.\n\nArgs:\n params: MCP server to diagnose MCP Apps wiring for.\n\nReturns:\n Diagnostic snapshot of MCP Apps wiring for the named server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPAppsDiagnoseResult.from_dict(await self._client.request("session.mcp.apps.diagnose", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class McpApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id self.oauth = McpOauthApi(client, session_id) self.headers = McpHeadersApi(client, session_id) self.apps = McpAppsApi(client, session_id) async def list(self, *, timeout: float | None = None) -> MCPServerList: "Lists MCP servers configured for the session, their connection status, and host-level state. The host-level state (disabled/filtered servers, failed/needs-auth/pending connections, mcp3p policy, full config) is empty/zero when no MCP host has been initialized for the session.\n\nReturns:\n MCP servers configured for the session, with their connection status and host-level state." return MCPServerList.from_dict(await self._client.request("session.mcp.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def list_tools(self, params: MCPListToolsRequest, *, timeout: float | None = None) -> MCPListToolsResult: "Lists the tools exposed by a connected MCP server on this session's host.\n\nArgs:\n params: Server name whose tool list should be returned.\n\nReturns:\n Tools exposed by the connected MCP server. Throws when the server is not connected." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPListToolsResult.from_dict(await self._client.request("session.mcp.listTools", params_dict, **_timeout_kwargs(timeout))) async def enable(self, params: MCPEnableRequest, *, timeout: float | None = None) -> None: "Enables an MCP server for the session.\n\nArgs:\n params: Name of the MCP server to enable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mcp.enable", params_dict, **_timeout_kwargs(timeout)) async def disable(self, params: MCPDisableRequest, *, timeout: float | None = None) -> None: "Disables an MCP server for the session.\n\nArgs:\n params: Name of the MCP server to disable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mcp.disable", params_dict, **_timeout_kwargs(timeout)) async def reload(self, *, timeout: float | None = None) -> None: "Reloads MCP server connections for the session." await self._client.request("session.mcp.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) async def execute_sampling(self, params: MCPExecuteSamplingParams, *, timeout: float | None = None) -> MCPSamplingExecutionResult: "Runs an MCP sampling inference on behalf of an MCP server.\n\nArgs:\n params: Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference.\n\nReturns:\n Outcome of an MCP sampling execution: success result, failure error, or cancellation." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPSamplingExecutionResult.from_dict(await self._client.request("session.mcp.executeSampling", params_dict, **_timeout_kwargs(timeout))) async def cancel_sampling_execution(self, params: MCPCancelSamplingExecutionParams, *, timeout: float | None = None) -> MCPCancelSamplingExecutionResult: "Cancels an in-flight MCP sampling execution by request ID.\n\nArgs:\n params: The requestId previously passed to executeSampling that should be cancelled.\n\nReturns:\n Indicates whether an in-flight sampling execution with the given requestId was found and cancelled." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPCancelSamplingExecutionResult.from_dict(await self._client.request("session.mcp.cancelSamplingExecution", params_dict, **_timeout_kwargs(timeout))) async def set_env_value_mode(self, params: MCPSetEnvValueModeParams, *, timeout: float | None = None) -> MCPSetEnvValueModeResult: "Sets how environment-variable values supplied to MCP servers are resolved (direct or indirect).\n\nArgs:\n params: Mode controlling how MCP server env values are resolved (`direct` or `indirect`).\n\nReturns:\n Env-value mode recorded on the session after the update." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPSetEnvValueModeResult.from_dict(await self._client.request("session.mcp.setEnvValueMode", params_dict, **_timeout_kwargs(timeout))) async def remove_git_hub(self, *, timeout: float | None = None) -> MCPRemoveGitHubResult: "Removes the auto-managed `github` MCP server when present.\n\nReturns:\n Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove)." return MCPRemoveGitHubResult.from_dict(await self._client.request("session.mcp.removeGitHub", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def stop_server(self, params: MCPStopServerRequest, *, timeout: float | None = None) -> None: "Stops an individual MCP server on the session's host.\n\nArgs:\n params: Server name for an individual MCP server stop." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mcp.stopServer", params_dict, **_timeout_kwargs(timeout)) async def is_server_running(self, params: MCPIsServerRunningRequest, *, timeout: float | None = None) -> MCPIsServerRunningResult: "Checks whether a named MCP server is currently running on the session's host.\n\nArgs:\n params: Server name to check running status for.\n\nReturns:\n Whether the named MCP server is running." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPIsServerRunningResult.from_dict(await self._client.request("session.mcp.isServerRunning", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class PluginsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def list(self, *, timeout: float | None = None) -> PluginList: "Lists plugins installed for the session.\n\nReturns:\n Plugins installed for the session, with their enabled state and version metadata." return PluginList.from_dict(await self._client.request("session.plugins.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def reload(self, params: PluginsReloadRequest | None = None, *, timeout: float | None = None) -> None: "Reloads the session's plugin set, refreshing MCP servers, custom agents, hooks, and skills cache so SDK-driven changes via `server.plugins.*` take effect immediately.\n\nArgs:\n params: Optional flags controlling which side effects the reload performs." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} params_dict["sessionId"] = self._session_id await self._client.request("session.plugins.reload", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class ProviderApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get_endpoint(self, params: ProviderGetEndpointRequest | None = None, *, timeout: float | None = None) -> ProviderEndpoint: "Returns the provider endpoint and credentials the session is currently configured to talk to, so the caller can make inference calls directly against the same backend the session uses.\n\nArgs:\n params: Optional model identifier to scope the endpoint snapshot to.\n\nReturns:\n A snapshot of the provider endpoint the session is currently configured to talk to." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} params_dict["sessionId"] = self._session_id return ProviderEndpoint.from_dict(await self._client.request("session.provider.getEndpoint", params_dict, **_timeout_kwargs(timeout))) async def add(self, params: ProviderAddRequest, *, timeout: float | None = None) -> ProviderAddResult: "Adds BYOK providers and/or models to the session's registry at runtime, extending the additive registry built from the session's `providers`/`models` options. Both fields are optional, so a call may add providers only, models only, or both. Within a single call providers are registered before models, so a model may reference a provider added in the same call; across calls a model may reference any provider already registered (from session creation or a prior add). A model whose referenced provider is not registered by the end of the call is rejected. Newly added models become selectable via `model.list` / `model.switchTo` and are inherited by sub-agents spawned afterwards.\n\nArgs:\n params: BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both.\n\nReturns:\n The selectable model entries synthesized for the models added by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return ProviderAddResult.from_dict(await self._client.request("session.provider.add", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class OptionsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def update(self, params: SessionUpdateOptionsParams, *, timeout: float | None = None) -> SessionUpdateOptionsResult: "Patches the genuinely-mutable subset of session options.\n\nArgs:\n params: Patch of mutable session options to apply to the running session.\n\nReturns:\n Indicates whether the session options patch was applied successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return SessionUpdateOptionsResult.from_dict(await self._client.request("session.options.update", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class LspApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def initialize(self, params: LspInitializeRequest, *, timeout: float | None = None) -> None: "Loads the merged LSP configuration set for the session's working directory.\n\nArgs:\n params: Parameters for (re)loading the merged LSP configuration set." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.lsp.initialize", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class ExtensionsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def list(self, *, timeout: float | None = None) -> ExtensionList: "Lists extensions discovered for the session and their current status.\n\nReturns:\n Extensions discovered for the session, with their current status." return ExtensionList.from_dict(await self._client.request("session.extensions.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def enable(self, params: ExtensionsEnableRequest, *, timeout: float | None = None) -> None: "Enables an extension for the session.\n\nArgs:\n params: Source-qualified extension identifier to enable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.extensions.enable", params_dict, **_timeout_kwargs(timeout)) async def disable(self, params: ExtensionsDisableRequest, *, timeout: float | None = None) -> None: "Disables an extension for the session.\n\nArgs:\n params: Source-qualified extension identifier to disable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.extensions.disable", params_dict, **_timeout_kwargs(timeout)) async def reload(self, *, timeout: float | None = None) -> None: "Reloads extension definitions and processes for the session." await self._client.request("session.extensions.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) async def send_attachments_to_message(self, params: SendAttachmentsToMessageParams, *, timeout: float | None = None) -> None: "Push attachments into the next user-message turn from an extension. The host should surface them as composer pills and forward them via the next session.send call. Callable only by extension-owned connections.\n\nArgs:\n params: Parameters for session.extensions.sendAttachmentsToMessage." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.extensions.sendAttachmentsToMessage", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class ToolsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def handle_pending_tool_call(self, params: HandlePendingToolCallRequest, *, timeout: float | None = None) -> HandlePendingToolCallResult: "Provides the result for a pending external tool call.\n\nArgs:\n params: Pending external tool call request ID, with the tool result or an error describing why it failed.\n\nReturns:\n Indicates whether the external tool call result was handled successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return HandlePendingToolCallResult.from_dict(await self._client.request("session.tools.handlePendingToolCall", params_dict, **_timeout_kwargs(timeout))) async def initialize_and_validate(self, *, timeout: float | None = None) -> ToolsInitializeAndValidateResult: "Resolves, builds, and validates the runtime tool list for the session.\n\nReturns:\n Resolve, build, and validate the runtime tool list for this session. Subagent sessions and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation." return ToolsInitializeAndValidateResult.from_dict(await self._client.request("session.tools.initializeAndValidate", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def get_current_metadata(self, *, timeout: float | None = None) -> ToolsGetCurrentMetadataResult: "Returns lightweight metadata for the session's currently initialized tools.\n\nReturns:\n Current lightweight tool metadata snapshot for the session." return ToolsGetCurrentMetadataResult.from_dict(await self._client.request("session.tools.getCurrentMetadata", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def update_subagent_settings(self, params: UpdateSubagentSettingsRequest, *, timeout: float | None = None) -> ToolsUpdateSubagentSettingsResult: "Updates the current session's live subagent settings after user settings change. The persisted user settings remain the source of truth for future sessions.\n\nArgs:\n params: Subagent settings to apply to the current session\n\nReturns:\n Empty result after applying subagent settings" params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return ToolsUpdateSubagentSettingsResult.from_dict(await self._client.request("session.tools.updateSubagentSettings", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class CommandsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def list(self, params: CommandsListRequest | None = None, *, timeout: float | None = None) -> CommandList: "Lists slash commands available in the session.\n\nArgs:\n params: Optional filters controlling which command sources to include in the listing.\n\nReturns:\n Slash commands available in the session, after applying any include/exclude filters." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} params_dict["sessionId"] = self._session_id return CommandList.from_dict(await self._client.request("session.commands.list", params_dict, **_timeout_kwargs(timeout))) async def invoke(self, params: CommandsInvokeRequest, *, timeout: float | None = None) -> SlashCommandInvocationResult: "Invokes a slash command in the session.\n\nArgs:\n params: Slash command name and optional raw input string to invoke.\n\nReturns:\n Result of invoking the slash command (text output, prompt to send to the agent, completion, or subcommand selection)." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return _load_SlashCommandInvocationResult(await self._client.request("session.commands.invoke", params_dict, **_timeout_kwargs(timeout))) async def handle_pending_command(self, params: CommandsHandlePendingCommandRequest, *, timeout: float | None = None) -> CommandsHandlePendingCommandResult: "Reports completion of a pending client-handled slash command.\n\nArgs:\n params: Pending command request ID and an optional error if the client handler failed.\n\nReturns:\n Indicates whether the pending client-handled command was completed successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return CommandsHandlePendingCommandResult.from_dict(await self._client.request("session.commands.handlePendingCommand", params_dict, **_timeout_kwargs(timeout))) async def execute(self, params: ExecuteCommandParams, *, timeout: float | None = None) -> ExecuteCommandResult: "Executes a slash command synchronously and returns any error.\n\nArgs:\n params: Slash command name and argument string to execute synchronously.\n\nReturns:\n Error message produced while executing the command, if any." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return ExecuteCommandResult.from_dict(await self._client.request("session.commands.execute", params_dict, **_timeout_kwargs(timeout))) async def enqueue(self, params: EnqueueCommandParams, *, timeout: float | None = None) -> EnqueueCommandResult: "Enqueues a slash command for FIFO processing on the local session.\n\nArgs:\n params: Slash-prefixed command string to enqueue for FIFO processing.\n\nReturns:\n Indicates whether the command was accepted into the local execution queue." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return EnqueueCommandResult.from_dict(await self._client.request("session.commands.enqueue", params_dict, **_timeout_kwargs(timeout))) async def respond_to_queued_command(self, params: CommandsRespondToQueuedCommandRequest, *, timeout: float | None = None) -> CommandsRespondToQueuedCommandResult: "Reports whether the host actually executed a queued command and whether to continue processing.\n\nArgs:\n params: Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands).\n\nReturns:\n Indicates whether the queued-command response was matched to a pending request." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return CommandsRespondToQueuedCommandResult.from_dict(await self._client.request("session.commands.respondToQueuedCommand", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class TelemetryApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get_engagement_id(self, *, timeout: float | None = None) -> SessionTelemetryEngagement: "Gets the telemetry engagement ID currently associated with the session, when available.\n\nReturns:\n Telemetry engagement ID for the session, when available." return SessionTelemetryEngagement.from_dict(await self._client.request("session.telemetry.getEngagementId", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def set_feature_overrides(self, params: TelemetrySetFeatureOverridesRequest, *, timeout: float | None = None) -> None: "Sets feature override key/value pairs to attach to subsequent telemetry events for the session.\n\nArgs:\n params: Feature override key/value pairs to attach to subsequent telemetry events from this session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.telemetry.setFeatureOverrides", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class UiApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def ephemeral_query(self, params: UIEphemeralQueryRequest, *, timeout: float | None = None) -> UIEphemeralQueryResult: "Runs a transient no-tools model query against the current conversation context.\n\nArgs:\n params: Transient question to answer without adding it to conversation history.\n\nReturns:\n Transient answer generated from current conversation context." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIEphemeralQueryResult.from_dict(await self._client.request("session.ui.ephemeralQuery", params_dict, **_timeout_kwargs(timeout))) async def elicitation(self, params: UIElicitationRequest, *, timeout: float | None = None) -> UIElicitationResponse: "Requests structured input from a UI-capable client.\n\nArgs:\n params: Prompt message and JSON schema describing the form fields to elicit from the user.\n\nReturns:\n The elicitation response (accept with form values, decline, or cancel)" params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIElicitationResponse.from_dict(await self._client.request("session.ui.elicitation", params_dict, **_timeout_kwargs(timeout))) async def handle_pending_elicitation(self, params: UIHandlePendingElicitationRequest, *, timeout: float | None = None) -> UIElicitationResult: "Provides the user response for a pending elicitation request.\n\nArgs:\n params: Pending elicitation request ID and the user's response (accept/decline/cancel + form values).\n\nReturns:\n Indicates whether the elicitation response was accepted; false if it was already resolved by another client." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIElicitationResult.from_dict(await self._client.request("session.ui.handlePendingElicitation", params_dict, **_timeout_kwargs(timeout))) async def handle_pending_user_input(self, params: UIHandlePendingUserInputRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `user_input.requested` event with the user's response.\n\nArgs:\n params: Request ID of a pending `user_input.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingUserInput", params_dict, **_timeout_kwargs(timeout))) async def handle_pending_sampling(self, params: UIHandlePendingSamplingRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `sampling.requested` event with a sampling result, or rejects it.\n\nArgs:\n params: Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject).\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingSampling", params_dict, **_timeout_kwargs(timeout))) async def handle_pending_auto_mode_switch(self, params: UIHandlePendingAutoModeSwitchRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `auto_mode_switch.requested` event with the user's accept/decline decision.\n\nArgs:\n params: Request ID of a pending `auto_mode_switch.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingAutoModeSwitch", params_dict, **_timeout_kwargs(timeout))) async def handle_pending_session_limits_exhausted(self, params: UIHandlePendingSessionLimitsExhaustedRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `session_limits_exhausted.requested` event with the user's selected limit action.\n\nArgs:\n params: Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingSessionLimitsExhausted", params_dict, **_timeout_kwargs(timeout))) async def handle_pending_exit_plan_mode(self, params: UIHandlePendingExitPlanModeRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `exit_plan_mode.requested` event with the user's response.\n\nArgs:\n params: Request ID of a pending `exit_plan_mode.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingExitPlanMode", params_dict, **_timeout_kwargs(timeout))) async def register_direct_auto_mode_switch_handler(self, *, timeout: float | None = None) -> UIRegisterDirectAutoModeSwitchHandlerResult: "Registers an in-process handler for auto-mode-switch requests so the server bridge skips dispatch.\n\nReturns:\n Register an in-process handler for `auto_mode_switch.requested` events. The caller still attaches the actual listener via the standard event-subscription mechanism; this registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId)." return UIRegisterDirectAutoModeSwitchHandlerResult.from_dict(await self._client.request("session.ui.registerDirectAutoModeSwitchHandler", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def unregister_direct_auto_mode_switch_handler(self, params: UIUnregisterDirectAutoModeSwitchHandlerRequest, *, timeout: float | None = None) -> UIUnregisterDirectAutoModeSwitchHandlerResult: "Unregisters a previously-registered in-process auto-mode-switch handler by its opaque handle.\n\nArgs:\n params: Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release.\n\nReturns:\n Indicates whether the handle was active and the registration count was decremented." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict(await self._client.request("session.ui.unregisterDirectAutoModeSwitchHandler", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class PermissionsPathsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def list(self, *, timeout: float | None = None) -> PermissionPathsList: "Returns the session's allowed directories and primary working directory.\n\nReturns:\n Snapshot of the session's allow-listed directories and primary working directory." return PermissionPathsList.from_dict(await self._client.request("session.permissions.paths.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def add(self, params: PermissionPathsAddParams, *, timeout: float | None = None) -> PermissionsPathsAddResult: "Adds a directory to the session's allow-list.\n\nArgs:\n params: Directory path to add to the session's allowed directories.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsPathsAddResult.from_dict(await self._client.request("session.permissions.paths.add", params_dict, **_timeout_kwargs(timeout))) async def update_primary(self, params: PermissionPathsUpdatePrimaryParams, *, timeout: float | None = None) -> PermissionsPathsUpdatePrimaryResult: "Updates the session's primary working directory used by the permission policy.\n\nArgs:\n params: Directory path to set as the session's new primary working directory.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsPathsUpdatePrimaryResult.from_dict(await self._client.request("session.permissions.paths.updatePrimary", params_dict, **_timeout_kwargs(timeout))) async def is_path_within_allowed_directories(self, params: PermissionPathsAllowedCheckParams, *, timeout: float | None = None) -> PermissionPathsAllowedCheckResult: "Reports whether a path falls within any of the session's allowed directories.\n\nArgs:\n params: Path to evaluate against the session's allowed directories.\n\nReturns:\n Indicates whether the supplied path is within the session's allowed directories." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionPathsAllowedCheckResult.from_dict(await self._client.request("session.permissions.paths.isPathWithinAllowedDirectories", params_dict, **_timeout_kwargs(timeout))) async def is_path_within_workspace(self, params: PermissionPathsWorkspaceCheckParams, *, timeout: float | None = None) -> PermissionPathsWorkspaceCheckResult: "Reports whether a path falls within the session's workspace (primary) directory.\n\nArgs:\n params: Path to evaluate against the session's workspace (primary) directory.\n\nReturns:\n Indicates whether the supplied path is within the session's workspace directory." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionPathsWorkspaceCheckResult.from_dict(await self._client.request("session.permissions.paths.isPathWithinWorkspace", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class PermissionsLocationsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def resolve(self, params: PermissionLocationResolveParams, *, timeout: float | None = None) -> PermissionLocationResolveResult: "Resolves the permission location key and type for a working directory.\n\nArgs:\n params: Working directory to resolve into a location-permissions key.\n\nReturns:\n Resolved location-permissions key and type." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionLocationResolveResult.from_dict(await self._client.request("session.permissions.locations.resolve", params_dict, **_timeout_kwargs(timeout))) async def apply(self, params: PermissionLocationApplyParams, *, timeout: float | None = None) -> PermissionLocationApplyResult: "Applies persisted location-scoped tool approvals and allowed directories for a working directory to this session's permission service.\n\nArgs:\n params: Working directory to load persisted location permissions for.\n\nReturns:\n Summary of persisted location permissions applied to the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionLocationApplyResult.from_dict(await self._client.request("session.permissions.locations.apply", params_dict, **_timeout_kwargs(timeout))) async def add_tool_approval(self, params: PermissionLocationAddToolApprovalParams, *, timeout: float | None = None) -> PermissionsLocationsAddToolApprovalResult: "Persists a tool approval for a permission location and applies its rules to this session's live permission service.\n\nArgs:\n params: Location-scoped tool approval to persist.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsLocationsAddToolApprovalResult.from_dict(await self._client.request("session.permissions.locations.addToolApproval", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class PermissionsFolderTrustApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def is_trusted(self, params: FolderTrustCheckParams, *, timeout: float | None = None) -> FolderTrustCheckResult: "Reports whether a folder is trusted according to the user's folder trust state.\n\nArgs:\n params: Folder path to check for trust.\n\nReturns:\n Folder trust check result." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return FolderTrustCheckResult.from_dict(await self._client.request("session.permissions.folderTrust.isTrusted", params_dict, **_timeout_kwargs(timeout))) async def add_trusted(self, params: FolderTrustAddParams, *, timeout: float | None = None) -> PermissionsFolderTrustAddTrustedResult: "Adds a folder to the user's trusted folders list.\n\nArgs:\n params: Folder path to add to trusted folders.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsFolderTrustAddTrustedResult.from_dict(await self._client.request("session.permissions.folderTrust.addTrusted", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class PermissionsUrlsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def set_unrestricted_mode(self, params: PermissionUrlsSetUnrestrictedModeParams, *, timeout: float | None = None) -> PermissionsUrlsSetUnrestrictedModeResult: "Toggles the runtime's URL-permission policy between unrestricted and restricted modes.\n\nArgs:\n params: Whether the URL-permission policy should run in unrestricted mode.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsUrlsSetUnrestrictedModeResult.from_dict(await self._client.request("session.permissions.urls.setUnrestrictedMode", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class PermissionsApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id self.paths = PermissionsPathsApi(client, session_id) self.locations = PermissionsLocationsApi(client, session_id) self.folder_trust = PermissionsFolderTrustApi(client, session_id) self.urls = PermissionsUrlsApi(client, session_id) async def configure(self, params: PermissionsConfigureParams, *, timeout: float | None = None) -> PermissionsConfigureResult: "Replaces selected permission policy fields (rules, paths, URLs, exclusions, allow-all flags) on the session.\n\nArgs:\n params: Patch of permission policy fields to apply (omit a field to leave it unchanged).\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsConfigureResult.from_dict(await self._client.request("session.permissions.configure", params_dict, **_timeout_kwargs(timeout))) async def handle_pending_permission_request(self, params: PermissionDecisionRequest, *, timeout: float | None = None) -> PermissionRequestResult: "Provides a decision for a pending tool permission request.\n\nArgs:\n params: Pending permission request ID and the decision to apply (approve/reject and scope).\n\nReturns:\n Indicates whether the permission decision was applied; false when the request was already resolved." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionRequestResult.from_dict(await self._client.request("session.permissions.handlePendingPermissionRequest", params_dict, **_timeout_kwargs(timeout))) async def pending_requests(self, *, timeout: float | None = None) -> PendingPermissionRequestList: "Reconstructs the set of pending tool permission requests from the session's event history.\n\nReturns:\n List of pending permission requests reconstructed from event history." return PendingPermissionRequestList.from_dict(await self._client.request("session.permissions.pendingRequests", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def set_approve_all(self, params: PermissionsSetApproveAllRequest, *, timeout: float | None = None) -> PermissionsSetApproveAllResult: "Enables or disables automatic approval of tool permission requests for the session.\n\nArgs:\n params: Allow-all toggle for tool permission requests, with an optional telemetry source.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsSetApproveAllResult.from_dict(await self._client.request("session.permissions.setApproveAll", params_dict, **_timeout_kwargs(timeout))) async def set_allow_all(self, params: PermissionsSetAllowAllRequest, *, timeout: float | None = None) -> AllowAllPermissionSetResult: "Enables or disables full allow-all permissions (tools, paths, and URLs) for the session. Used by attach-mode clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's permission state. Unlike `setApproveAll`, this swaps in the unrestricted path and URL managers and emits `session.permissions_changed` on transition. The result returns the authoritative post-mutation state so callers can update their local mirrors without racing the `session.permissions_changed` notification on the same wire.\n\nArgs:\n params: Whether to enable full allow-all permissions for the session.\n\nReturns:\n Indicates whether the operation succeeded and reports the post-mutation state." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return AllowAllPermissionSetResult.from_dict(await self._client.request("session.permissions.setAllowAll", params_dict, **_timeout_kwargs(timeout))) async def get_allow_all(self, *, timeout: float | None = None) -> AllowAllPermissionState: "Returns whether full allow-all permissions are currently active for the session.\n\nReturns:\n Current full allow-all permission state." return AllowAllPermissionState.from_dict(await self._client.request("session.permissions.getAllowAll", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def modify_rules(self, params: PermissionsModifyRulesParams, *, timeout: float | None = None) -> PermissionsModifyRulesResult: "Adds or removes session-scoped or location-scoped permission rules.\n\nArgs:\n params: Scope and add/remove instructions for modifying session- or location-scoped permission rules.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsModifyRulesResult.from_dict(await self._client.request("session.permissions.modifyRules", params_dict, **_timeout_kwargs(timeout))) async def set_required(self, params: PermissionsSetRequiredRequest, *, timeout: float | None = None) -> PermissionsSetRequiredResult: "Sets whether the client wants permission prompts bridged into session events.\n\nArgs:\n params: Toggles whether permission prompts should be bridged into session events for this client.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsSetRequiredResult.from_dict(await self._client.request("session.permissions.setRequired", params_dict, **_timeout_kwargs(timeout))) async def reset_session_approvals(self, *, timeout: float | None = None) -> PermissionsResetSessionApprovalsResult: "Clears session-scoped tool permission approvals.\n\nReturns:\n Indicates whether the operation succeeded." return PermissionsResetSessionApprovalsResult.from_dict(await self._client.request("session.permissions.resetSessionApprovals", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def notify_prompt_shown(self, params: PermissionPromptShownNotification, *, timeout: float | None = None) -> PermissionsNotifyPromptShownResult: "Notifies the runtime that a permission prompt UI has been shown to the user.\n\nArgs:\n params: Notification payload describing the permission prompt that the client just rendered.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return PermissionsNotifyPromptShownResult.from_dict(await self._client.request("session.permissions.notifyPromptShown", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class MetadataApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def snapshot(self, *, timeout: float | None = None) -> SessionMetadataSnapshot: "Returns a snapshot of the session's identifying metadata, mode, agent, and remote info.\n\nReturns:\n Point-in-time snapshot of slow-changing session identifier and state fields" return SessionMetadataSnapshot.from_dict(await self._client.request("session.metadata.snapshot", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def is_processing(self, *, timeout: float | None = None) -> MetadataIsProcessingResult: "Reports whether the local session is currently processing user/agent messages.\n\nReturns:\n Indicates whether the local session is currently processing a turn or background continuation." return MetadataIsProcessingResult.from_dict(await self._client.request("session.metadata.isProcessing", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def activity(self, *, timeout: float | None = None) -> SessionActivity: "Returns a snapshot of activity flags for the session.\n\nReturns:\n Current activity flags for the session." return SessionActivity.from_dict(await self._client.request("session.metadata.activity", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def context_info(self, params: MetadataContextInfoRequest, *, timeout: float | None = None) -> MetadataContextInfoResult: "Returns the token breakdown for the session's current context window for a given model.\n\nArgs:\n params: Model identifier and token limits used to compute the context-info breakdown.\n\nReturns:\n Token breakdown for the session's current context window, or null if uninitialized." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MetadataContextInfoResult.from_dict(await self._client.request("session.metadata.contextInfo", params_dict, **_timeout_kwargs(timeout))) async def record_context_change(self, params: MetadataRecordContextChangeRequest, *, timeout: float | None = None) -> MetadataRecordContextChangeResult: "Records a working-directory/git context change and emits a `session.context_changed` event.\n\nArgs:\n params: Updated working-directory/git context to record on the session.\n\nReturns:\n Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode)." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MetadataRecordContextChangeResult.from_dict(await self._client.request("session.metadata.recordContextChange", params_dict, **_timeout_kwargs(timeout))) async def set_working_directory(self, params: MetadataSetWorkingDirectoryRequest, *, timeout: float | None = None) -> MetadataSetWorkingDirectoryResult: "Updates the session's recorded working directory.\n\nArgs:\n params: Absolute path to set as the session's new working directory.\n\nReturns:\n Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for `process.chdir` and any related side-effects (file index, etc.); this method only updates the session's own recorded path." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MetadataSetWorkingDirectoryResult.from_dict(await self._client.request("session.metadata.setWorkingDirectory", params_dict, **_timeout_kwargs(timeout))) async def recompute_context_tokens(self, params: MetadataRecomputeContextTokensRequest, *, timeout: float | None = None) -> MetadataRecomputeContextTokensResult: "Re-tokenizes the session's existing messages against a model and returns aggregate token totals.\n\nArgs:\n params: Model identifier to use when re-tokenizing the session's existing messages.\n\nReturns:\n Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MetadataRecomputeContextTokensResult.from_dict(await self._client.request("session.metadata.recomputeContextTokens", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ShellApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def exec(self, params: ShellExecRequest, *, timeout: float | None = None) -> ShellExecResult: "Starts a shell command and streams output through session notifications.\n\nArgs:\n params: Shell command to run, with optional working directory and timeout in milliseconds.\n\nReturns:\n Identifier of the spawned process, used to correlate streamed output and exit notifications." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return ShellExecResult.from_dict(await self._client.request("session.shell.exec", params_dict, **_timeout_kwargs(timeout))) async def kill(self, params: ShellKillRequest, *, timeout: float | None = None) -> ShellKillResult: "Sends a signal to a shell process previously started via \"shell.exec\".\n\nArgs:\n params: Identifier of a process previously returned by \"shell.exec\" and the signal to send.\n\nReturns:\n Indicates whether the signal was delivered; false if the process was unknown or already exited." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return ShellKillResult.from_dict(await self._client.request("session.shell.kill", params_dict, **_timeout_kwargs(timeout))) async def execute_user_requested(self, params: ShellExecuteUserRequestedRequest, *, timeout: float | None = None) -> UserRequestedShellCommandResult: "Executes a user-requested shell command through the session runtime.\n\nArgs:\n params: User-requested shell command and cancellation handle.\n\nReturns:\n Result of a user-requested shell command." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return UserRequestedShellCommandResult.from_dict(await self._client.request("session.shell.executeUserRequested", params_dict, **_timeout_kwargs(timeout))) async def cancel_user_requested(self, params: ShellCancelUserRequestedRequest, *, timeout: float | None = None) -> CancelUserRequestedShellCommandResult: "Cancels a user-requested shell command by request ID.\n\nArgs:\n params: User-requested shell execution cancellation handle.\n\nReturns:\n Cancellation result for a user-requested shell command." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return CancelUserRequestedShellCommandResult.from_dict(await self._client.request("session.shell.cancelUserRequested", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class HistoryApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def compact(self, params: HistoryCompactRequest | None = None, *, timeout: float | None = None) -> HistoryCompactResult: "Compacts the session history to reduce context usage.\n\nArgs:\n params: Optional compaction parameters.\n\nReturns:\n Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} params_dict["sessionId"] = self._session_id return HistoryCompactResult.from_dict(await self._client.request("session.history.compact", params_dict, **_timeout_kwargs(timeout))) async def truncate(self, params: HistoryTruncateRequest, *, timeout: float | None = None) -> HistoryTruncateResult: "Truncates persisted session history to a specific event.\n\nArgs:\n params: Identifier of the event to truncate to; this event and all later events are removed.\n\nReturns:\n Number of events that were removed by the truncation." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return HistoryTruncateResult.from_dict(await self._client.request("session.history.truncate", params_dict, **_timeout_kwargs(timeout))) async def cancel_background_compaction(self, *, timeout: float | None = None) -> HistoryCancelBackgroundCompactionResult: "Cancels any in-progress background compaction on a local session.\n\nReturns:\n Indicates whether an in-progress background compaction was cancelled." return HistoryCancelBackgroundCompactionResult.from_dict(await self._client.request("session.history.cancelBackgroundCompaction", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def abort_manual_compaction(self, *, timeout: float | None = None) -> HistoryAbortManualCompactionResult: "Aborts any in-progress manual compaction on a local session.\n\nReturns:\n Indicates whether an in-progress manual compaction was aborted." return HistoryAbortManualCompactionResult.from_dict(await self._client.request("session.history.abortManualCompaction", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def summarize_for_handoff(self, *, timeout: float | None = None) -> HistorySummarizeForHandoffResult: "Produces a markdown summary of the session's conversation context for hand-off scenarios.\n\nReturns:\n Markdown summary of the conversation context (empty when not available)." return HistorySummarizeForHandoffResult.from_dict(await self._client.request("session.history.summarizeForHandoff", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class QueueApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def pending_items(self, *, timeout: float | None = None) -> QueuePendingItemsResult: "Returns the local session's pending user-facing queued items and steering messages.\n\nReturns:\n Snapshot of the session's pending queued items and immediate-steering messages." return QueuePendingItemsResult.from_dict(await self._client.request("session.queue.pendingItems", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def remove_most_recent(self, *, timeout: float | None = None) -> QueueRemoveMostRecentResult: "Removes the most recently queued user-facing item (LIFO).\n\nReturns:\n Indicates whether a user-facing pending item was removed." return QueueRemoveMostRecentResult.from_dict(await self._client.request("session.queue.removeMostRecent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def clear(self, *, timeout: float | None = None) -> None: "Clears all pending queued items on the local session." await self._client.request("session.queue.clear", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. class EventLogApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def read(self, params: EventLogReadRequest, *, timeout: float | None = None) -> EventsReadResult: "Reads a batch of session events from a cursor, optionally waiting for new events.\n\nArgs:\n params: Cursor, batch size, and optional long-poll/filter parameters for reading session events.\n\nReturns:\n Batch of session events returned by a read, with cursor and continuation metadata." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return EventsReadResult.from_dict(await self._client.request("session.eventLog.read", params_dict, **_timeout_kwargs(timeout))) async def tail(self, *, timeout: float | None = None) -> EventLogTailResult: "Returns a snapshot of the current tail cursor without consuming events.\n\nReturns:\n Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session)." return EventLogTailResult.from_dict(await self._client.request("session.eventLog.tail", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def register_interest(self, params: RegisterEventInterestParams, *, timeout: float | None = None) -> RegisterEventInterestResult: "Registers consumer interest in an event type for runtime gating purposes.\n\nArgs:\n params: Event type to register consumer interest for, used by runtime gating logic.\n\nReturns:\n Opaque handle representing an event-type interest registration." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return RegisterEventInterestResult.from_dict(await self._client.request("session.eventLog.registerInterest", params_dict, **_timeout_kwargs(timeout))) async def release_interest(self, params: ReleaseEventInterestParams, *, timeout: float | None = None) -> EventLogReleaseInterestResult: "Releases a consumer's previously-registered interest in an event type.\n\nArgs:\n params: Opaque handle previously returned by `registerInterest` to release.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return EventLogReleaseInterestResult.from_dict(await self._client.request("session.eventLog.releaseInterest", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class UsageApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get_metrics(self, *, timeout: float | None = None) -> UsageGetMetricsResult: "Gets accumulated usage metrics for the session.\n\nReturns:\n Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals." return UsageGetMetricsResult.from_dict(await self._client.request("session.usage.getMetrics", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class RemoteApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def enable(self, params: RemoteEnableRequest, *, timeout: float | None = None) -> RemoteEnableResult: "Enables remote session export or steering.\n\nArgs:\n params: Optional remote session mode (\"off\", \"export\", or \"on\"); defaults to enabling both export and remote steering.\n\nReturns:\n GitHub URL for the session and a flag indicating whether remote steering is enabled." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return RemoteEnableResult.from_dict(await self._client.request("session.remote.enable", params_dict, **_timeout_kwargs(timeout))) async def disable(self, *, timeout: float | None = None) -> None: "Disables remote session export and steering." await self._client.request("session.remote.disable", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) async def notify_steerable_changed(self, params: RemoteNotifySteerableChangedRequest, *, timeout: float | None = None) -> RemoteNotifySteerableChangedResult: "Persists a remote-steerability change emitted by the host as a session event.\n\nArgs:\n params: New remote-steerability state to persist as a `session.remote_steerable_changed` event.\n\nReturns:\n Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return RemoteNotifySteerableChangedResult.from_dict(await self._client.request("session.remote.notifySteerableChanged", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class VisibilityApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def get(self, *, timeout: float | None = None) -> VisibilityGetResult: "Returns the session's current Mission Control sharing status and shareable GitHub URL. Reflects whether the synced session is visible to repository readers (\"repo\") or restricted to its creator and collaborators (\"unshared\").\n\nReturns:\n Current sharing status and shareable GitHub URL for a session." return VisibilityGetResult.from_dict(await self._client.request("session.visibility.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def set(self, params: VisibilitySetRequest, *, timeout: float | None = None) -> VisibilitySetResult: "Sets the session's Mission Control sharing status, controlling whether the synced session is visible to repository readers. Returns the effective status and shareable GitHub URL after the change.\n\nArgs:\n params: Desired sharing status for the session.\n\nReturns:\n Effective sharing status and shareable GitHub URL after updating session visibility." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return VisibilitySetResult.from_dict(await self._client.request("session.visibility.set", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class ScheduleApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def list(self, *, timeout: float | None = None) -> ScheduleList: "Lists the session's currently active scheduled prompts.\n\nReturns:\n Snapshot of the currently active recurring prompts for this session." return ScheduleList.from_dict(await self._client.request("session.schedule.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def stop(self, params: ScheduleStopRequest, *, timeout: float | None = None) -> ScheduleStopResult: "Removes a scheduled prompt by id.\n\nArgs:\n params: Identifier of the scheduled prompt to remove.\n\nReturns:\n Remove a scheduled prompt by id. The result entry is omitted if the id was unknown." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return ScheduleStopResult.from_dict(await self._client.request("session.schedule.stop", params_dict, **_timeout_kwargs(timeout))) class SessionRpc: """Typed session-scoped RPC methods.""" def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id self.git_hub_auth = GitHubAuthApi(client, session_id) self.canvas = CanvasApi(client, session_id) self.model = ModelApi(client, session_id) self.mode = ModeApi(client, session_id) self.name = NameApi(client, session_id) self.plan = PlanApi(client, session_id) self.workspaces = WorkspacesApi(client, session_id) self.completions = CompletionsApi(client, session_id) self.instructions = InstructionsApi(client, session_id) self.fleet = FleetApi(client, session_id) self.agent = AgentApi(client, session_id) self.tasks = TasksApi(client, session_id) self.skills = SkillsApi(client, session_id) self.mcp = McpApi(client, session_id) self.plugins = PluginsApi(client, session_id) self.provider = ProviderApi(client, session_id) self.options = OptionsApi(client, session_id) self.lsp = LspApi(client, session_id) self.extensions = ExtensionsApi(client, session_id) self.tools = ToolsApi(client, session_id) self.commands = CommandsApi(client, session_id) self.telemetry = TelemetryApi(client, session_id) self.ui = UiApi(client, session_id) self.permissions = PermissionsApi(client, session_id) self.metadata = MetadataApi(client, session_id) self.shell = ShellApi(client, session_id) self.history = HistoryApi(client, session_id) self.queue = QueueApi(client, session_id) self.event_log = EventLogApi(client, session_id) self.usage = UsageApi(client, session_id) self.remote = RemoteApi(client, session_id) self.visibility = VisibilityApi(client, session_id) self.schedule = ScheduleApi(client, session_id) async def suspend(self, *, timeout: float | None = None) -> None: "Suspends the session while preserving persisted state for later resume.\n\n.. warning:: This API is experimental and may change or be removed in future versions." await self._client.request("session.suspend", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) async def send(self, params: SendRequest, *, timeout: float | None = None) -> SendResult: "Sends a user message to the session and returns its message ID.\n\nArgs:\n params: Parameters for sending a user message to the session\n\nReturns:\n Result of sending a user message\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return SendResult.from_dict(await self._client.request("session.send", params_dict, **_timeout_kwargs(timeout))) async def abort(self, params: AbortRequest, *, timeout: float | None = None) -> AbortResult: "Aborts the current agent turn.\n\nArgs:\n params: Parameters for aborting the current turn\n\nReturns:\n Result of aborting the current turn\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return AbortResult.from_dict(await self._client.request("session.abort", params_dict, **_timeout_kwargs(timeout))) async def shutdown(self, params: ShutdownRequest, *, timeout: float | None = None) -> None: "Shuts down the session and persists its final state. Awaits any deferred sessionEnd hooks before resolving so user-supplied hook scripts complete before the runtime tears down.\n\nArgs:\n params: Parameters for shutting down the session\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.shutdown", params_dict, **_timeout_kwargs(timeout)) async def log(self, params: LogRequest, *, timeout: float | None = None) -> LogResult: "Emits a user-visible session log event.\n\nArgs:\n params: Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip.\n\nReturns:\n Identifier of the session event that was emitted for the log message.\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return LogResult.from_dict(await self._client.request("session.log", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class _InternalMcpOauthApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id async def _respond(self, params: MCPOauthRespondRequest, *, timeout: float | None = None) -> MCPOauthRespondResult: "Responds to a pending MCP OAuth request with an in-process provider. This internal CLI-only API accepts a live OAuthClientProvider instance and cannot be used over the SDK JSON-RPC boundary. Use session.mcp.oauth.handlePendingRequest instead for the public SDK-safe response path.\n\nArgs:\n params: MCP OAuth request id and optional provider response.\n\nReturns:\n Empty result after recording the MCP OAuth response.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPOauthRespondResult.from_dict(await self._client.request("session.mcp.oauth.respond", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. class _InternalMcpApi: def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id self.oauth = _InternalMcpOauthApi(client, session_id) async def _reload_with_config(self, params: MCPReloadWithConfigRequest, *, timeout: float | None = None) -> MCPStartServersResult: "Reloads MCP server connections for the session with an explicit host-provided configuration.\n\nArgs:\n params: Opaque MCP reload configuration.\n\nReturns:\n MCP server startup filtering result.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPStartServersResult.from_dict(await self._client.request("session.mcp.reloadWithConfig", params_dict, **_timeout_kwargs(timeout))) async def _configure_git_hub(self, params: MCPConfigureGitHubRequest, *, timeout: float | None = None) -> MCPConfigureGitHubResult: "Configures the built-in GitHub MCP server for the session's current auth context.\n\nArgs:\n params: Opaque auth info used to configure GitHub MCP.\n\nReturns:\n Result of configuring GitHub MCP.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id return MCPConfigureGitHubResult.from_dict(await self._client.request("session.mcp.configureGitHub", params_dict, **_timeout_kwargs(timeout))) async def _start_server(self, params: MCPStartServerRequest, *, timeout: float | None = None) -> None: "Starts an individual MCP server on the session's host.\n\nArgs:\n params: Server name and opaque configuration for an individual MCP server start.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mcp.startServer", params_dict, **_timeout_kwargs(timeout)) async def _restart_server(self, params: MCPRestartServerRequest, *, timeout: float | None = None) -> None: "Restarts an individual MCP server on the session's host (stops then starts).\n\nArgs:\n params: Server name and opaque configuration for an individual MCP server restart.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mcp.restartServer", params_dict, **_timeout_kwargs(timeout)) async def _register_external_client(self, params: MCPRegisterExternalClientRequest, *, timeout: float | None = None) -> None: "Registers a pre-connected external MCP client (e.g. IDE) on the session's host. The caller retains lifecycle ownership of the client and transport. Marked internal because the `client` and `transport` arguments are in-process MCP SDK instances that cannot be serialized across the JSON-RPC boundary; once the CLI moves on top of the SDK, external clients will be expressed as transport configs the runtime can construct itself.\n\nArgs:\n params: Registration parameters for an external MCP client.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mcp.registerExternalClient", params_dict, **_timeout_kwargs(timeout)) async def _unregister_external_client(self, params: MCPUnregisterExternalClientRequest, *, timeout: float | None = None) -> None: "Unregisters a previously registered external MCP client by server name. Marked internal as the paired companion of `registerExternalClient`: only in-process callers that registered a client this way can meaningfully unregister it. Disappears alongside `registerExternalClient`: once external clients are described to the runtime as config rather than handed in as instances, lifecycle (including deregistration) is owned entirely by the runtime.\n\nArgs:\n params: Server name identifying the external client to remove.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id await self._client.request("session.mcp.unregisterExternalClient", params_dict, **_timeout_kwargs(timeout)) class _InternalSessionRpc: """Internal SDK session-scoped RPC methods. Not part of the public API.""" def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id self.mcp = _InternalMcpApi(client, session_id) # Experimental: this API group is experimental and may change or be removed. class ProviderTokenHandler(Protocol): async def get_token(self, params: ProviderTokenAcquireRequest) -> ProviderTokenAcquireResult: "Asks the SDK client to get a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Session-scoped: the runtime calls it back on the connection that most recently supplied that provider's config for the session (the creating connection, or a resuming connection if the session was resumed — distinct providers may be owned by different connections), passing the provider name, and uses the returned token as the Authorization header for the outbound model request. The runtime does no caching — it calls this once per outbound request; the SDK consumer owns token acquisition, caching, and refresh.\n\nArgs:\n params: Asks the SDK client to acquire a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Issued by the runtime before each outbound model request; the runtime does no caching, so this is sent once per request.\n\nReturns:\n A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer ` on the outbound request and does no caching; the SDK consumer owns token caching and refresh." pass # Experimental: this API group is experimental and may change or be removed. class SessionFsHandler(Protocol): async def read_file(self, params: SessionFSReadFileRequest) -> SessionFSReadFileResult: "Reads a file from the client-provided session filesystem.\n\nArgs:\n params: Path of the file to read from the client-provided session filesystem.\n\nReturns:\n File content as a UTF-8 string, or a filesystem error if the read failed." pass async def write_file(self, params: SessionFSWriteFileRequest) -> SessionFSError | None: "Writes a file in the client-provided session filesystem.\n\nArgs:\n params: File path, content to write, and optional mode for the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass async def append_file(self, params: SessionFSAppendFileRequest) -> SessionFSError | None: "Appends content to a file in the client-provided session filesystem.\n\nArgs:\n params: File path, content to append, and optional mode for the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass async def exists(self, params: SessionFSExistsRequest) -> SessionFSExistsResult: "Checks whether a path exists in the client-provided session filesystem.\n\nArgs:\n params: Path to test for existence in the client-provided session filesystem.\n\nReturns:\n Indicates whether the requested path exists in the client-provided session filesystem." pass async def stat(self, params: SessionFSStatRequest) -> SessionFSStatResult: "Gets metadata for a path in the client-provided session filesystem.\n\nArgs:\n params: Path whose metadata should be returned from the client-provided session filesystem.\n\nReturns:\n Filesystem metadata for the requested path, or a filesystem error if the stat failed." pass async def mkdir(self, params: SessionFSMkdirRequest) -> SessionFSError | None: "Creates a directory in the client-provided session filesystem.\n\nArgs:\n params: Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode.\n\nReturns:\n Describes a filesystem error." pass async def readdir(self, params: SessionFSReaddirRequest) -> SessionFSReaddirResult: "Lists entry names in a directory from the client-provided session filesystem.\n\nArgs:\n params: Directory path whose entries should be listed from the client-provided session filesystem.\n\nReturns:\n Names of entries in the requested directory, or a filesystem error if the read failed." pass async def readdir_with_types(self, params: SessionFSReaddirWithTypesRequest) -> SessionFSReaddirWithTypesResult: "Lists directory entries with type information from the client-provided session filesystem.\n\nArgs:\n params: Directory path whose entries (with type information) should be listed from the client-provided session filesystem.\n\nReturns:\n Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed." pass async def rm(self, params: SessionFSRmRequest) -> SessionFSError | None: "Removes a file or directory from the client-provided session filesystem.\n\nArgs:\n params: Path to remove from the client-provided session filesystem, with options for recursive removal and force.\n\nReturns:\n Describes a filesystem error." pass async def rename(self, params: SessionFSRenameRequest) -> SessionFSError | None: "Renames or moves a path in the client-provided session filesystem.\n\nArgs:\n params: Source and destination paths for renaming or moving an entry in the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass async def sqlite_query(self, params: SessionFSSqliteQueryRequest) -> SessionFSSqliteQueryResult: "Executes a SQLite query against the per-session database.\n\nArgs:\n params: SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database.\n\nReturns:\n Query results including rows, columns, and rows affected, or a filesystem error if execution failed." pass async def sqlite_exists(self, params: SessionFSSqliteExistsRequest) -> SessionFSSqliteExistsResult: "Checks whether the per-session SQLite database already exists, without creating it.\n\nArgs:\n params: Identifies the target session.\n\nReturns:\n Indicates whether the per-session SQLite database already exists." pass # Experimental: this API group is experimental and may change or be removed. class CanvasHandler(Protocol): async def open(self, params: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: "Opens a canvas instance on the provider.\n\nArgs:\n params: Canvas open parameters sent to the provider.\n\nReturns:\n Canvas open result returned by the provider." pass async def close(self, params: CanvasProviderCloseRequest) -> None: "Closes a canvas instance on the provider.\n\nArgs:\n params: Canvas close parameters sent to the provider." pass async def invoke(self, params: CanvasProviderInvokeActionRequest) -> Any: "Invokes an action on an open canvas instance via the provider.\n\nArgs:\n params: Canvas action invocation parameters sent to the provider.\n\nReturns:\n Provider-supplied action result." pass @dataclass class ClientSessionApiHandlers: provider_token: ProviderTokenHandler | None = None session_fs: SessionFsHandler | None = None canvas: CanvasHandler | None = None def register_client_session_api_handlers( client: "JsonRpcClient", get_handlers: Callable[[str], ClientSessionApiHandlers], ) -> None: """Register client-session request handlers on a JSON-RPC connection.""" async def handle_provider_token_get_token(params: dict) -> dict | None: request = ProviderTokenAcquireRequest.from_dict(params) handler = get_handlers(request.session_id).provider_token if handler is None: raise RuntimeError(f"No provider_token handler registered for session: {request.session_id}") result = await handler.get_token(request) return result.to_dict() client.set_request_handler("providerToken.getToken", handle_provider_token_get_token) async def handle_session_fs_read_file(params: dict) -> dict | None: request = SessionFSReadFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.read_file(request) return result.to_dict() client.set_request_handler("sessionFs.readFile", handle_session_fs_read_file) async def handle_session_fs_write_file(params: dict) -> dict | None: request = SessionFSWriteFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.write_file(request) return result.to_dict() if result is not None else None client.set_request_handler("sessionFs.writeFile", handle_session_fs_write_file) async def handle_session_fs_append_file(params: dict) -> dict | None: request = SessionFSAppendFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.append_file(request) return result.to_dict() if result is not None else None client.set_request_handler("sessionFs.appendFile", handle_session_fs_append_file) async def handle_session_fs_exists(params: dict) -> dict | None: request = SessionFSExistsRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.exists(request) return result.to_dict() client.set_request_handler("sessionFs.exists", handle_session_fs_exists) async def handle_session_fs_stat(params: dict) -> dict | None: request = SessionFSStatRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.stat(request) return result.to_dict() client.set_request_handler("sessionFs.stat", handle_session_fs_stat) async def handle_session_fs_mkdir(params: dict) -> dict | None: request = SessionFSMkdirRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.mkdir(request) return result.to_dict() if result is not None else None client.set_request_handler("sessionFs.mkdir", handle_session_fs_mkdir) async def handle_session_fs_readdir(params: dict) -> dict | None: request = SessionFSReaddirRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.readdir(request) return result.to_dict() client.set_request_handler("sessionFs.readdir", handle_session_fs_readdir) async def handle_session_fs_readdir_with_types(params: dict) -> dict | None: request = SessionFSReaddirWithTypesRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.readdir_with_types(request) return result.to_dict() client.set_request_handler("sessionFs.readdirWithTypes", handle_session_fs_readdir_with_types) async def handle_session_fs_rm(params: dict) -> dict | None: request = SessionFSRmRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.rm(request) return result.to_dict() if result is not None else None client.set_request_handler("sessionFs.rm", handle_session_fs_rm) async def handle_session_fs_rename(params: dict) -> dict | None: request = SessionFSRenameRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.rename(request) return result.to_dict() if result is not None else None client.set_request_handler("sessionFs.rename", handle_session_fs_rename) async def handle_session_fs_sqlite_query(params: dict) -> dict | None: request = SessionFSSqliteQueryRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.sqlite_query(request) return result.to_dict() client.set_request_handler("sessionFs.sqliteQuery", handle_session_fs_sqlite_query) async def handle_session_fs_sqlite_exists(params: dict) -> dict | None: request = SessionFSSqliteExistsRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.sqlite_exists(request) return result.to_dict() client.set_request_handler("sessionFs.sqliteExists", handle_session_fs_sqlite_exists) async def handle_canvas_open(params: dict) -> dict | None: request = CanvasProviderOpenRequest.from_dict(params) handler = get_handlers(request.session_id).canvas if handler is None: raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") result = await handler.open(request) return result.to_dict() client.set_request_handler("canvas.open", handle_canvas_open) async def handle_canvas_close(params: dict) -> dict | None: request = CanvasProviderCloseRequest.from_dict(params) handler = get_handlers(request.session_id).canvas if handler is None: raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") await handler.close(request) return None client.set_request_handler("canvas.close", handle_canvas_close) async def handle_canvas_action_invoke(params: dict) -> dict | None: request = CanvasProviderInvokeActionRequest.from_dict(params) handler = get_handlers(request.session_id).canvas if handler is None: raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") result = await handler.invoke(request) return result.value if hasattr(result, 'value') else result client.set_request_handler("canvas.action.invoke", handle_canvas_action_invoke) # Experimental: this API group is experimental and may change or be removed. class LlmInferenceHandler(Protocol): async def http_request_start(self, params: LlmInferenceHTTPRequestStartRequest) -> LlmInferenceHTTPRequestStartResult: "Announces an outbound model-layer HTTP request the runtime wants the SDK client to service. Carries the request head only; the body always follows as one or more httpRequestChunk frames keyed by the same requestId, even when the body is empty (a single chunk with end=true).\n\nArgs:\n params: The head of an outbound model-layer HTTP request.\n\nReturns:\n Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed." pass async def http_request_chunk(self, params: LlmInferenceHTTPRequestChunkRequest) -> LlmInferenceHTTPRequestChunkResult: "Delivers a body byte range (or a cancellation signal) for a request previously announced via httpRequestStart, correlated by requestId. The runtime fires at least one chunk per request — when there is no body, a single chunk with empty data and end=true. Mid-stream the runtime may send a chunk with cancel=true to abort the request; the SDK then stops issuing httpResponseChunk frames and may emit a terminal httpResponseChunk with error set.\n\nArgs:\n params: A request body chunk or cancellation signal.\n\nReturns:\n Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget." pass # Experimental: this API group is experimental and may change or be removed. class GitHubTelemetryHandler(Protocol): async def event(self, params: GitHubTelemetryNotification) -> None: "Forwards a single GitHub telemetry event to a host connection that opted into telemetry forwarding for the session.\n\nArgs:\n params: Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding for the session." pass @dataclass class ClientGlobalApiHandlers: llm_inference: LlmInferenceHandler | None = None git_hub_telemetry: GitHubTelemetryHandler | None = None def register_client_global_api_handlers( client: "JsonRpcClient", handlers: ClientGlobalApiHandlers, ) -> None: """Register client-global request handlers on a JSON-RPC connection. Unlike client-session handlers these methods carry no implicit session_id dispatch key; a single set of handlers serves the entire connection. """ async def handle_llm_inference_http_request_start(params: dict) -> dict | None: request = LlmInferenceHTTPRequestStartRequest.from_dict(params) handler = handlers.llm_inference if handler is None: raise RuntimeError("No llm_inference client-global handler registered") result = await handler.http_request_start(request) return result.to_dict() client.set_request_handler("llmInference.httpRequestStart", handle_llm_inference_http_request_start) async def handle_llm_inference_http_request_chunk(params: dict) -> dict | None: request = LlmInferenceHTTPRequestChunkRequest.from_dict(params) handler = handlers.llm_inference if handler is None: raise RuntimeError("No llm_inference client-global handler registered") result = await handler.http_request_chunk(request) return result.to_dict() client.set_request_handler("llmInference.httpRequestChunk", handle_llm_inference_http_request_chunk) async def handle_git_hub_telemetry_event(params: dict) -> dict | None: request = GitHubTelemetryNotification.from_dict(params) handler = handlers.git_hub_telemetry if handler is None: raise RuntimeError("No git_hub_telemetry client-global handler registered") await handler.event(request) return None client.set_request_handler("gitHubTelemetry.event", handle_git_hub_telemetry_event) __all__ = [ "APIKeyAuthInfo", "APIKeyAuthInfoType", "AbortRequest", "AbortResult", "AccountAllUsers", "AccountGetAllUsersResult", "AccountGetCurrentAuthResult", "AccountGetQuotaRequest", "AccountGetQuotaResult", "AccountLoginRequest", "AccountLoginResult", "AccountLogoutRequest", "AccountLogoutResult", "AccountQuotaSnapshot", "AdaptiveThinkingSupport", "AdditionalContentExclusionPolicyScope", "AgentApi", "AgentDiscoveryPath", "AgentDiscoveryPathList", "AgentDiscoveryPathScope", "AgentGetCurrentResult", "AgentInfo", "AgentInfoSource", "AgentList", "AgentRegistryLiveTargetEntry", "AgentRegistryLiveTargetEntryAttentionKind", "AgentRegistryLiveTargetEntryKind", "AgentRegistryLiveTargetEntryLastTerminalEvent", "AgentRegistryLiveTargetEntryStatus", "AgentRegistryLogCapture", "AgentRegistryLogCaptureOpenErrorReason", "AgentRegistrySpawnError", "AgentRegistrySpawnErrorKind", "AgentRegistrySpawnPermissionMode", "AgentRegistrySpawnRegistryTimeout", "AgentRegistrySpawnRegistryTimeoutKind", "AgentRegistrySpawnRequest", "AgentRegistrySpawnResult", "AgentRegistrySpawnResultKind", "AgentRegistrySpawnSpawned", "AgentRegistrySpawnSpawnedKind", "AgentRegistrySpawnValidationError", "AgentRegistrySpawnValidationErrorField", "AgentRegistrySpawnValidationErrorKind", "AgentRegistrySpawnValidationErrorReason", "AgentReloadResult", "AgentSelectRequest", "AgentSelectResult", "AgentsDiscoverRequest", "AgentsGetDiscoveryPathsRequest", "AllowAllPermissionSetResult", "AllowAllPermissionState", "ApprovalKind", "AuthInfo", "AuthInfoType", "CancelUserRequestedShellCommandResult", "CanvasAction", "CanvasActionApi", "CanvasActionInvokeRequest", "CanvasActionInvokeResult", "CanvasApi", "CanvasCloseRequest", "CanvasHandler", "CanvasHostContext", "CanvasHostContextCapabilities", "CanvasJsonSchema", "CanvasList", "CanvasListOpenResult", "CanvasOpenRequest", "CanvasProviderCloseRequest", "CanvasProviderInvokeActionRequest", "CanvasProviderOpenRequest", "CanvasProviderOpenResult", "CanvasSessionContext", "CapiSessionOptions", "ClientGlobalApiHandlers", "ClientSessionApiHandlers", "CommandList", "CommandsApi", "CommandsHandlePendingCommandRequest", "CommandsHandlePendingCommandResult", "CommandsInvokeRequest", "CommandsListRequest", "CommandsRespondToQueuedCommandRequest", "CommandsRespondToQueuedCommandResult", "CompletionsApi", "CompletionsGetTriggerCharactersResult", "CompletionsRequestRequest", "CompletionsRequestResult", "ConnectRemoteSessionParams", "ConnectedRemoteSessionMetadata", "ConnectedRemoteSessionMetadataKind", "ConnectedRemoteSessionMetadataRepository", "ContentFilterMode", "CopilotAPITokenAuthInfo", "CopilotAPITokenAuthInfoType", "CopilotUserResponse", "CopilotUserResponseEndpoints", "CopilotUserResponseQuotaSnapshots", "CopilotUserResponseQuotaSnapshotsChat", "CopilotUserResponseQuotaSnapshotsCompletions", "CopilotUserResponseQuotaSnapshotsPremiumInteractions", "CurrentModel", "CurrentToolMetadata", "DiscoveredCanvas", "DiscoveredMCPServer", "DiscoveredMCPServerType", "EnqueueCommandParams", "EnqueueCommandResult", "EnvAuthInfo", "EnvAuthInfoType", "EventLogApi", "EventLogReadRequest", "EventLogReleaseInterestResult", "EventLogTailResult", "EventLogTypes", "EventsAgentScope", "EventsCursorStatus", "EventsReadResult", "ExecuteCommandParams", "ExecuteCommandResult", "Extension", "ExtensionContextPushInput", "ExtensionContextPushInputType", "ExtensionList", "ExtensionSource", "ExtensionStatus", "ExtensionsApi", "ExtensionsDisableRequest", "ExtensionsEnableRequest", "ExternalToolResult", "ExternalToolTextResultForLlm", "ExternalToolTextResultForLlmBinaryResultsForLlm", "ExternalToolTextResultForLlmBinaryResultsForLlmType", "ExternalToolTextResultForLlmContent", "ExternalToolTextResultForLlmContentAudio", "ExternalToolTextResultForLlmContentAudioType", "ExternalToolTextResultForLlmContentImage", "ExternalToolTextResultForLlmContentImageType", "ExternalToolTextResultForLlmContentResource", "ExternalToolTextResultForLlmContentResourceDetails", "ExternalToolTextResultForLlmContentResourceLink", "ExternalToolTextResultForLlmContentResourceLinkIcon", "ExternalToolTextResultForLlmContentResourceLinkIconTheme", "ExternalToolTextResultForLlmContentResourceLinkType", "ExternalToolTextResultForLlmContentResourceType", "ExternalToolTextResultForLlmContentShellExit", "ExternalToolTextResultForLlmContentShellExitType", "ExternalToolTextResultForLlmContentTerminal", "ExternalToolTextResultForLlmContentTerminalType", "ExternalToolTextResultForLlmContentText", "ExternalToolTextResultForLlmContentType", "FilterMapping", "FleetApi", "FleetStartRequest", "FleetStartResult", "FluffySource", "FolderTrustAddParams", "FolderTrustCheckParams", "FolderTrustCheckResult", "GhCLIAuthInfo", "GhCLIAuthInfoType", "GitHubAuthApi", "GitHubTelemetryClientInfo", "GitHubTelemetryEvent", "GitHubTelemetryHandler", "GitHubTelemetryNotification", "HMACAuthInfo", "HMACAuthInfoType", "HandlePendingToolCallRequest", "HandlePendingToolCallResult", "HistoryAbortManualCompactionResult", "HistoryApi", "HistoryCancelBackgroundCompactionResult", "HistoryCompactContextWindow", "HistoryCompactRequest", "HistoryCompactResult", "HistorySummarizeForHandoffResult", "HistoryTruncateRequest", "HistoryTruncateResult", "Host", "HostType", "InstalledPlugin", "InstalledPluginInfo", "InstalledPluginSource", "InstalledPluginSourceGitHub", "InstalledPluginSourceLocal", "InstalledPluginSourceURL", "InstructionDiscoveryPath", "InstructionDiscoveryPathKind", "InstructionDiscoveryPathList", "InstructionDiscoveryPathLocation", "InstructionLocation", "InstructionSource", "InstructionSourceLocation", "InstructionSourceType", "InstructionsApi", "InstructionsDiscoverRequest", "InstructionsGetDiscoveryPathsRequest", "InstructionsGetSourcesResult", "KindEnum", "LlmInferenceHTTPRequestChunkRequest", "LlmInferenceHTTPRequestChunkResult", "LlmInferenceHTTPRequestStartRequest", "LlmInferenceHTTPRequestStartResult", "LlmInferenceHTTPRequestStartTransport", "LlmInferenceHTTPResponseChunkError", "LlmInferenceHTTPResponseChunkRequest", "LlmInferenceHTTPResponseChunkResult", "LlmInferenceHTTPResponseStartRequest", "LlmInferenceHTTPResponseStartResult", "LlmInferenceHandler", "LlmInferenceHeaders", "LlmInferenceSetProviderResult", "LocalSessionMetadataValue", "LogRequest", "LogResult", "LspApi", "LspInitializeRequest", "MCPAllowedServer", "MCPAppsCallToolRequest", "MCPAppsDiagnoseCapability", "MCPAppsDiagnoseRequest", "MCPAppsDiagnoseResult", "MCPAppsDiagnoseServer", "MCPAppsDisplayMode", "MCPAppsHostContext", "MCPAppsHostContextDetails", "MCPAppsHostContextDetailsPlatform", "MCPAppsListToolsRequest", "MCPAppsListToolsResult", "MCPAppsReadResourceRequest", "MCPAppsReadResourceResult", "MCPAppsResourceContent", "MCPAppsSetHostContextDetails", "MCPAppsSetHostContextRequest", "MCPCancelSamplingExecutionParams", "MCPCancelSamplingExecutionResult", "MCPConfigAddRequest", "MCPConfigDisableRequest", "MCPConfigEnableRequest", "MCPConfigList", "MCPConfigRemoveRequest", "MCPConfigUpdateRequest", "MCPConfigureGitHubRequest", "MCPConfigureGitHubResult", "MCPDisableRequest", "MCPDiscoverRequest", "MCPDiscoverResult", "MCPEnableRequest", "MCPExecuteSamplingParams", "MCPFilteredServer", "MCPGrantType", "MCPHeadersHandlePendingHeadersRefreshRequest", "MCPHeadersHandlePendingHeadersRefreshRequestKind", "MCPHeadersHandlePendingHeadersRefreshRequestRequest", "MCPHeadersHandlePendingHeadersRefreshRequestResult", "MCPHostState", "MCPIsServerRunningRequest", "MCPIsServerRunningResult", "MCPListToolsRequest", "MCPListToolsResult", "MCPOauthHandlePendingRequest", "MCPOauthHandlePendingResult", "MCPOauthLoginRequest", "MCPOauthLoginResult", "MCPOauthPendingRequestResponse", "MCPOauthPendingRequestResponseKind", "MCPOauthRespondRequest", "MCPOauthRespondResult", "MCPRegisterExternalClientRequest", "MCPReloadWithConfigRequest", "MCPRemoveGitHubResult", "MCPRestartServerRequest", "MCPSamplingExecutionAction", "MCPSamplingExecutionResult", "MCPServer", "MCPServerAuthConfigRedirectPort", "MCPServerConfig", "MCPServerConfigDeferTools", "MCPServerConfigHTTP", "MCPServerConfigHTTPType", "MCPServerConfigStdio", "MCPServerFailureInfo", "MCPServerList", "MCPServerNeedsAuthInfo", "MCPSetEnvValueModeDetails", "MCPSetEnvValueModeParams", "MCPSetEnvValueModeResult", "MCPStartServerRequest", "MCPStartServersResult", "MCPStopServerRequest", "MCPTools", "MCPUnregisterExternalClientRequest", "MarketplaceAddResult", "MarketplaceBrowseResult", "MarketplaceInfo", "MarketplaceListResult", "MarketplacePluginInfo", "MarketplaceRefreshEntry", "MarketplaceRefreshResult", "MarketplaceRemoveResult", "McpApi", "McpAppsApi", "McpAppsHostContextDetailsAvailableDisplayMode", "McpAppsHostContextDetailsDisplayMode", "McpAppsHostContextDetailsTheme", "McpAppsSetHostContextDetailsAvailableDisplayMode", "McpAppsSetHostContextDetailsDisplayMode", "McpAppsSetHostContextDetailsPlatform", "McpAppsSetHostContextDetailsTheme", "McpExecuteSamplingRequest", "McpExecuteSamplingResult", "McpHeadersApi", "McpOauthApi", "McpOauthLoginGrantType", "McpServerAuthConfig", "McpServerConfigHttpOauthGrantType", "MemoryConfiguration", "MetadataApi", "MetadataContextInfoRequest", "MetadataContextInfoResult", "MetadataIsProcessingResult", "MetadataRecomputeContextTokensRequest", "MetadataRecomputeContextTokensResult", "MetadataRecordContextChangeRequest", "MetadataRecordContextChangeResult", "MetadataSetWorkingDirectoryRequest", "MetadataSetWorkingDirectoryResult", "MetadataSnapshotCurrentMode", "MetadataSnapshotRemoteMetadata", "MetadataSnapshotRemoteMetadataRepository", "MetadataSnapshotRemoteMetadataTaskType", "ModeApi", "ModeSetRequest", "Model", "ModelApi", "ModelBilling", "ModelBillingTokenPrices", "ModelBillingTokenPricesLongContext", "ModelCapabilities", "ModelCapabilitiesLimits", "ModelCapabilitiesLimitsVision", "ModelCapabilitiesOverride", "ModelCapabilitiesOverrideLimits", "ModelCapabilitiesOverrideLimitsVision", "ModelCapabilitiesOverrideSupports", "ModelCapabilitiesSupports", "ModelList", "ModelListRequest", "ModelPickerCategory", "ModelPickerPriceCategory", "ModelPolicy", "ModelPolicyState", "ModelSetReasoningEffortRequest", "ModelSetReasoningEffortResult", "ModelSwitchToRequest", "ModelSwitchToResult", "ModelsListRequest", "NameApi", "NameGetResult", "NameSetAutoRequest", "NameSetAutoResult", "NameSetRequest", "NamedProviderConfig", "OpenCanvasInstance", "OptionsApi", "OptionsUpdateAdditionalContentExclusionPolicy", "OptionsUpdateAdditionalContentExclusionPolicyRule", "OptionsUpdateAdditionalContentExclusionPolicyRuleSource", "OptionsUpdateAdditionalContentExclusionPolicyScope", "OptionsUpdateContextTier", "OptionsUpdateEnvValueMode", "OptionsUpdateReasoningSummary", "OptionsUpdateToolFilterPrecedence", "PendingPermissionRequest", "PendingPermissionRequestList", "PermissionDecision", "PermissionDecisionApproveForIonApproval", "PermissionDecisionApproveForLocation", "PermissionDecisionApproveForLocationApproval", "PermissionDecisionApproveForLocationApprovalCommands", "PermissionDecisionApproveForLocationApprovalCommandsKind", "PermissionDecisionApproveForLocationApprovalCustomTool", "PermissionDecisionApproveForLocationApprovalCustomToolKind", "PermissionDecisionApproveForLocationApprovalExtensionManagement", "PermissionDecisionApproveForLocationApprovalExtensionManagementKind", "PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess", "PermissionDecisionApproveForLocationApprovalExtensionPermissionAccessKind", "PermissionDecisionApproveForLocationApprovalMCP", "PermissionDecisionApproveForLocationApprovalMCPKind", "PermissionDecisionApproveForLocationApprovalMCPSampling", "PermissionDecisionApproveForLocationApprovalMCPSamplingKind", "PermissionDecisionApproveForLocationApprovalMemory", "PermissionDecisionApproveForLocationApprovalMemoryKind", "PermissionDecisionApproveForLocationApprovalRead", "PermissionDecisionApproveForLocationApprovalReadKind", "PermissionDecisionApproveForLocationApprovalWrite", "PermissionDecisionApproveForLocationApprovalWriteKind", "PermissionDecisionApproveForLocationKind", "PermissionDecisionApproveForSession", "PermissionDecisionApproveForSessionApproval", "PermissionDecisionApproveForSessionApprovalCommands", "PermissionDecisionApproveForSessionApprovalCustomTool", "PermissionDecisionApproveForSessionApprovalExtensionManagement", "PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess", "PermissionDecisionApproveForSessionApprovalMCP", "PermissionDecisionApproveForSessionApprovalMCPSampling", "PermissionDecisionApproveForSessionApprovalMemory", "PermissionDecisionApproveForSessionApprovalRead", "PermissionDecisionApproveForSessionApprovalWrite", "PermissionDecisionApproveForSessionKind", "PermissionDecisionApproveOnce", "PermissionDecisionApproveOnceKind", "PermissionDecisionApprovePermanently", "PermissionDecisionApprovePermanentlyKind", "PermissionDecisionApproved", "PermissionDecisionApprovedForLocation", "PermissionDecisionApprovedForLocationKind", "PermissionDecisionApprovedForSession", "PermissionDecisionApprovedForSessionKind", "PermissionDecisionApprovedKind", "PermissionDecisionCancelled", "PermissionDecisionCancelledKind", "PermissionDecisionDeniedByContentExclusionPolicy", "PermissionDecisionDeniedByContentExclusionPolicyKind", "PermissionDecisionDeniedByPermissionRequestHook", "PermissionDecisionDeniedByPermissionRequestHookKind", "PermissionDecisionDeniedByRules", "PermissionDecisionDeniedByRulesKind", "PermissionDecisionDeniedInteractivelyByUser", "PermissionDecisionDeniedInteractivelyByUserKind", "PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser", "PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind", "PermissionDecisionKind", "PermissionDecisionReject", "PermissionDecisionRejectKind", "PermissionDecisionRequest", "PermissionDecisionUserNotAvailable", "PermissionDecisionUserNotAvailableKind", "PermissionLocationAddToolApprovalParams", "PermissionLocationApplyParams", "PermissionLocationApplyResult", "PermissionLocationResolveParams", "PermissionLocationResolveResult", "PermissionLocationType", "PermissionPathsAddParams", "PermissionPathsAllowedCheckParams", "PermissionPathsAllowedCheckResult", "PermissionPathsConfig", "PermissionPathsList", "PermissionPathsUpdatePrimaryParams", "PermissionPathsWorkspaceCheckParams", "PermissionPathsWorkspaceCheckResult", "PermissionPromptShownNotification", "PermissionRequestResult", "PermissionRulesSet", "PermissionUrlsConfig", "PermissionUrlsSetUnrestrictedModeParams", "PermissionsApi", "PermissionsConfigureAdditionalContentExclusionPolicy", "PermissionsConfigureAdditionalContentExclusionPolicyRule", "PermissionsConfigureAdditionalContentExclusionPolicyRuleSource", "PermissionsConfigureAdditionalContentExclusionPolicyScope", "PermissionsConfigureParams", "PermissionsConfigureResult", "PermissionsFolderTrustAddTrustedResult", "PermissionsFolderTrustApi", "PermissionsGetAllowAllRequest", "PermissionsLocationsAddToolApprovalDetails", "PermissionsLocationsAddToolApprovalDetailsCommands", "PermissionsLocationsAddToolApprovalDetailsCustomTool", "PermissionsLocationsAddToolApprovalDetailsExtensionManagement", "PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess", "PermissionsLocationsAddToolApprovalDetailsMCP", "PermissionsLocationsAddToolApprovalDetailsMCPSampling", "PermissionsLocationsAddToolApprovalDetailsMemory", "PermissionsLocationsAddToolApprovalDetailsRead", "PermissionsLocationsAddToolApprovalDetailsWrite", "PermissionsLocationsAddToolApprovalResult", "PermissionsLocationsApi", "PermissionsModifyRulesParams", "PermissionsModifyRulesResult", "PermissionsModifyRulesScope", "PermissionsNotifyPromptShownResult", "PermissionsPathsAddResult", "PermissionsPathsApi", "PermissionsPathsListRequest", "PermissionsPathsUpdatePrimaryResult", "PermissionsPendingRequestsRequest", "PermissionsResetSessionApprovalsRequest", "PermissionsResetSessionApprovalsResult", "PermissionsSetAAllSource", "PermissionsSetAllowAllRequest", "PermissionsSetAllowAllSource", "PermissionsSetApproveAllRequest", "PermissionsSetApproveAllResult", "PermissionsSetApproveAllSource", "PermissionsSetRequiredRequest", "PermissionsSetRequiredResult", "PermissionsUrlsApi", "PermissionsUrlsSetUnrestrictedModeResult", "PingRequest", "PingResult", "PlanApi", "PlanReadResult", "PlanReadSQLTodosResult", "PlanReadSQLTodosWithDependenciesResult", "PlanSQLTodoDependency", "PlanSQLTodosRow", "PlanUpdateRequest", "Plugin", "PluginInstallResult", "PluginList", "PluginListResult", "PluginUpdateAllEntry", "PluginUpdateAllResult", "PluginUpdateResult", "PluginsApi", "PluginsDisableRequest", "PluginsEnableRequest", "PluginsInstallRequest", "PluginsMarketplacesAddRequest", "PluginsMarketplacesBrowseRequest", "PluginsMarketplacesRefreshRequest", "PluginsMarketplacesRemoveRequest", "PluginsReloadRequest", "PluginsUninstallRequest", "PluginsUpdateRequest", "PollSpawnedSessionsResult", "ProviderAddRequest", "ProviderAddResult", "ProviderApi", "ProviderConfig", "ProviderConfigAzure", "ProviderConfigTransport", "ProviderConfigType", "ProviderConfigWireApi", "ProviderEndpoint", "ProviderEndpointTransport", "ProviderEndpointType", "ProviderEndpointWireApi", "ProviderGetEndpointRequest", "ProviderModelConfig", "ProviderSessionToken", "ProviderTokenAcquireRequest", "ProviderTokenAcquireResult", "ProviderTokenHandler", "ProviderTransport", "ProviderType", "ProviderWireAPI", "PurpleSource", "PushAttachment", "PushAttachmentBlob", "PushAttachmentBlobType", "PushAttachmentDirectory", "PushAttachmentFile", "PushAttachmentFileLineRange", "PushAttachmentFileType", "PushAttachmentGitHubActionsJob", "PushAttachmentGitHubActionsJobType", "PushAttachmentGitHubCommit", "PushAttachmentGitHubCommitType", "PushAttachmentGitHubFile", "PushAttachmentGitHubFileDiff", "PushAttachmentGitHubFileDiffSide", "PushAttachmentGitHubFileDiffType", "PushAttachmentGitHubFileType", "PushAttachmentGitHubReference", "PushAttachmentGitHubReferenceType", "PushAttachmentGitHubReferenceTypeEnum", "PushAttachmentGitHubRelease", "PushAttachmentGitHubReleaseType", "PushAttachmentGitHubRepository", "PushAttachmentGitHubRepositoryType", "PushAttachmentGitHubSide", "PushAttachmentGitHubSnippet", "PushAttachmentGitHubSnippetType", "PushAttachmentGitHubTreeComparison", "PushAttachmentGitHubTreeComparisonSide", "PushAttachmentGitHubTreeComparisonType", "PushAttachmentGitHubURL", "PushAttachmentGitHubURLType", "PushAttachmentSelection", "PushAttachmentSelectionDetails", "PushAttachmentSelectionDetailsEnd", "PushAttachmentSelectionDetailsStart", "PushAttachmentSelectionType", "PushAttachmentType", "PushGitHubRepoRef", "QueueApi", "QueuePendingItems", "QueuePendingItemsKind", "QueuePendingItemsResult", "QueueRemoveMostRecentResult", "QueuedCommandHandled", "QueuedCommandNotHandled", "QueuedCommandResult", "RPC", "RegisterEventInterestParams", "RegisterEventInterestResult", "ReleaseEventInterestParams", "RemoteApi", "RemoteControlConfig", "RemoteControlConfigExistingMcSession", "RemoteControlStatus", "RemoteControlStatusActive", "RemoteControlStatusActiveState", "RemoteControlStatusConnecting", "RemoteControlStatusConnectingState", "RemoteControlStatusError", "RemoteControlStatusErrorState", "RemoteControlStatusOff", "RemoteControlStatusOffState", "RemoteControlStatusResult", "RemoteControlStatusState", "RemoteControlStopResult", "RemoteControlTransferResult", "RemoteEnableRequest", "RemoteEnableResult", "RemoteNotifySteerableChangedRequest", "RemoteNotifySteerableChangedResult", "RemoteSessionConnectionResult", "RemoteSessionMetadataRepository", "RemoteSessionMetadataTaskType", "RemoteSessionMetadataValue", "RemoteSessionMode", "RemoteSessionRepository", "SandboxConfig", "SandboxConfigUserPolicy", "SandboxConfigUserPolicyExperimental", "SandboxConfigUserPolicyExperimentalSeatbelt", "SandboxConfigUserPolicyFilesystem", "SandboxConfigUserPolicyNetwork", "SandboxConfigUserPolicySeatbelt", "Saved", "ScheduleApi", "ScheduleEntry", "ScheduleList", "ScheduleStopRequest", "ScheduleStopResult", "SecretsAddFilterValuesRequest", "SecretsAddFilterValuesResult", "SendAgentMode", "SendAttachmentsToMessageParams", "SendMode", "SendRequest", "SendResult", "ServerAccountApi", "ServerAgentList", "ServerAgentRegistryApi", "ServerAgentsApi", "ServerInstructionSourceList", "ServerInstructionsApi", "ServerLlmInferenceApi", "ServerMcpApi", "ServerMcpConfigApi", "ServerModelsApi", "ServerPluginsApi", "ServerPluginsMarketplacesApi", "ServerRpc", "ServerRuntimeApi", "ServerSecretsApi", "ServerSessionFsApi", "ServerSessionsApi", "ServerSkill", "ServerSkillList", "ServerSkillsApi", "ServerSkillsConfigApi", "ServerToolsApi", "ServerUserApi", "ServerUserSettingsApi", "SessionActivity", "SessionAuthStatus", "SessionBulkDeleteResult", "SessionCapability", "SessionCompletionItem", "SessionContext", "SessionContextHostType", "SessionContextInfo", "SessionEnrichMetadataResult", "SessionFSAppendFileRequest", "SessionFSError", "SessionFSErrorCode", "SessionFSExistsRequest", "SessionFSExistsResult", "SessionFSMkdirRequest", "SessionFSReadFileRequest", "SessionFSReadFileResult", "SessionFSReaddirRequest", "SessionFSReaddirResult", "SessionFSReaddirWithTypesEntry", "SessionFSReaddirWithTypesRequest", "SessionFSReaddirWithTypesResult", "SessionFSRenameRequest", "SessionFSRmRequest", "SessionFSSetProviderCapabilities", "SessionFSSetProviderConventions", "SessionFSSetProviderRequest", "SessionFSSetProviderResult", "SessionFSSqliteExistsRequest", "SessionFSSqliteExistsResult", "SessionFSSqliteQueryRequest", "SessionFSSqliteQueryResult", "SessionFSSqliteQueryType", "SessionFSStatRequest", "SessionFSStatResult", "SessionFSWriteFileRequest", "SessionFsHandler", "SessionFsReaddirWithTypesEntryType", "SessionInstalledPlugin", "SessionInstalledPluginSource", "SessionInstalledPluginSourceGitHub", "SessionInstalledPluginSourceLocal", "SessionInstalledPluginSourceURL", "SessionList", "SessionListEntry", "SessionListFilter", "SessionLoadDeferredRepoHooksResult", "SessionLogLevel", "SessionMcpAppsCallToolResult", "SessionMetadataSnapshot", "SessionModelList", "SessionOpenOptions", "SessionOpenOptionsAdditionalContentExclusionPolicy", "SessionOpenOptionsAdditionalContentExclusionPolicyRule", "SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource", "SessionOpenOptionsAdditionalContentExclusionPolicyScope", "SessionOpenOptionsEnvValueMode", "SessionOpenOptionsReasoningSummary", "SessionOpenParams", "SessionOpenParamsKind", "SessionOpenResult", "SessionPruneResult", "SessionRpc", "SessionSetCredentialsParams", "SessionSetCredentialsResult", "SessionSizes", "SessionSource", "SessionTelemetryEngagement", "SessionUpdateOptionsParams", "SessionUpdateOptionsResult", "SessionVisibilityStatus", "SessionWorkingDirectoryContext", "SessionWorkingDirectoryContextHostType", "SessionsBulkDeleteRequest", "SessionsCheckInUseRequest", "SessionsCheckInUseResult", "SessionsCloseRequest", "SessionsCloseResult", "SessionsEnrichMetadataRequest", "SessionsFindByPrefixRequest", "SessionsFindByPrefixResult", "SessionsFindByTaskIDRequest", "SessionsFindByTaskIDResult", "SessionsForkRequest", "SessionsForkResult", "SessionsGetBoardEntryCountRequest", "SessionsGetBoardEntryCountResult", "SessionsGetEventFilePathRequest", "SessionsGetEventFilePathResult", "SessionsGetLastForContextRequest", "SessionsGetLastForContextResult", "SessionsGetPersistedRemoteSteerableRequest", "SessionsGetPersistedRemoteSteerableResult", "SessionsListRequest", "SessionsLoadDeferredRepoHooksRequest", "SessionsOpenAttach", "SessionsOpenAttachKind", "SessionsOpenCloud", "SessionsOpenCloudKind", "SessionsOpenCreate", "SessionsOpenCreateKind", "SessionsOpenHandoff", "SessionsOpenHandoffKind", "SessionsOpenHandoffTaskType", "SessionsOpenProgress", "SessionsOpenProgressStatus", "SessionsOpenProgressStep", "SessionsOpenRemote", "SessionsOpenRemoteKind", "SessionsOpenResume", "SessionsOpenResumeKind", "SessionsOpenResumeLast", "SessionsOpenResumeLastKind", "SessionsOpenStatus", "SessionsPollSpawnedSessionsEvent", "SessionsPollSpawnedSessionsRequest", "SessionsPruneOldRequest", "SessionsRegisterExtensionToolsOnSessionOptions", "SessionsReleaseLockRequest", "SessionsReleaseLockResult", "SessionsReloadPluginHooksRequest", "SessionsReloadPluginHooksResult", "SessionsSaveRequest", "SessionsSaveResult", "SessionsSetAdditionalPluginsRequest", "SessionsSetAdditionalPluginsResult", "SessionsSetRemoteControlSteeringRequest", "SessionsStartRemoteControlRequest", "SessionsStopRemoteControlRequest", "SessionsTransferRemoteControlRequest", "ShellApi", "ShellCancelUserRequestedRequest", "ShellExecRequest", "ShellExecResult", "ShellExecuteUserRequestedRequest", "ShellKillRequest", "ShellKillResult", "ShellKillSignal", "ShutdownRequest", "Skill", "SkillDiscoveryPath", "SkillDiscoveryPathList", "SkillDiscoveryScope", "SkillList", "SkillsApi", "SkillsConfigSetDisabledSkillsRequest", "SkillsDisableRequest", "SkillsDiscoverRequest", "SkillsEnableRequest", "SkillsGetDiscoveryPathsRequest", "SkillsGetInvokedResult", "SkillsInvokedSkill", "SkillsLoadDiagnostics", "SlashCommandAgentPromptResult", "SlashCommandAgentPromptResultKind", "SlashCommandCompletedResult", "SlashCommandCompletedResultKind", "SlashCommandInfo", "SlashCommandInput", "SlashCommandInputCompletion", "SlashCommandInvocationResult", "SlashCommandInvocationResultKind", "SlashCommandKind", "SlashCommandSelectSubcommandOption", "SlashCommandSelectSubcommandResult", "SlashCommandSelectSubcommandResultKind", "SlashCommandTextResult", "StickySource", "SubagentSettings", "SubagentSettingsEntry", "SubagentSettingsEntryContextTier", "TaskAgentInfo", "TaskAgentInfoType", "TaskAgentProgress", "TaskExecutionMode", "TaskInfo", "TaskInfoExecutionMode", "TaskInfoStatus", "TaskInfoType", "TaskList", "TaskProgress", "TaskProgressLine", "TaskShellInfo", "TaskShellInfoAttachmentMode", "TaskShellInfoType", "TaskShellProgress", "TaskStatus", "TaskType", "TasksApi", "TasksCancelRequest", "TasksCancelResult", "TasksGetCurrentPromotableResult", "TasksGetProgressRequest", "TasksGetProgressResult", "TasksPromoteCurrentToBackgroundResult", "TasksPromoteToBackgroundRequest", "TasksPromoteToBackgroundResult", "TasksRefreshResult", "TasksRemoveRequest", "TasksRemoveResult", "TasksSendMessageRequest", "TasksSendMessageResult", "TasksStartAgentRequest", "TasksStartAgentResult", "TasksWaitForPendingResult", "TelemetryApi", "TelemetrySetFeatureOverridesRequest", "TentacledSource", "Theme", "TokenAuthInfo", "TokenAuthInfoType", "Tool", "ToolList", "ToolsApi", "ToolsGetCurrentMetadataResult", "ToolsInitializeAndValidateResult", "ToolsListRequest", "ToolsUpdateSubagentSettingsResult", "UIAutoModeSwitchResponse", "UIElicitationArrayAnyOfField", "UIElicitationArrayAnyOfFieldItems", "UIElicitationArrayAnyOfFieldItemsAnyOf", "UIElicitationArrayAnyOfFieldType", "UIElicitationArrayEnumField", "UIElicitationArrayEnumFieldItems", "UIElicitationArrayEnumFieldItemsType", "UIElicitationArrayFieldItems", "UIElicitationRequest", "UIElicitationResponse", "UIElicitationResponseAction", "UIElicitationResult", "UIElicitationSchema", "UIElicitationSchemaProperty", "UIElicitationSchemaPropertyBoolean", "UIElicitationSchemaPropertyBooleanType", "UIElicitationSchemaPropertyNumber", "UIElicitationSchemaPropertyNumberType", "UIElicitationSchemaPropertyString", "UIElicitationSchemaPropertyStringFormat", "UIElicitationSchemaPropertyType", "UIElicitationSchemaType", "UIElicitationStringEnumField", "UIElicitationStringOneOfField", "UIElicitationStringOneOfFieldOneOf", "UIEphemeralQueryRequest", "UIEphemeralQueryResult", "UIExitPlanModeAction", "UIExitPlanModeResponse", "UIHandlePendingAutoModeSwitchRequest", "UIHandlePendingElicitationRequest", "UIHandlePendingExitPlanModeRequest", "UIHandlePendingResult", "UIHandlePendingSamplingRequest", "UIHandlePendingSessionLimitsExhaustedRequest", "UIHandlePendingUserInputRequest", "UIRegisterDirectAutoModeSwitchHandlerResult", "UISessionLimitsExhaustedResponse", "UISessionLimitsExhaustedResponseAction", "UIUnregisterDirectAutoModeSwitchHandlerRequest", "UIUnregisterDirectAutoModeSwitchHandlerResult", "UIUserInputResponse", "UiApi", "UpdateSubagentSettingsRequest", "UsageApi", "UsageGetMetricsResult", "UsageMetricsCodeChanges", "UsageMetricsModelMetric", "UsageMetricsModelMetricRequests", "UsageMetricsModelMetricTokenDetail", "UsageMetricsModelMetricUsage", "UsageMetricsTokenDetail", "UserAuthInfo", "UserAuthInfoType", "UserRequestedShellCommandResult", "UserSettingMetadata", "UserSettingsGetResult", "UserSettingsSetRequest", "UserSettingsSetResult", "VisibilityApi", "VisibilityGetResult", "VisibilitySetRequest", "VisibilitySetResult", "Workspace", "WorkspaceDiffFileChange", "WorkspaceDiffFileChangeType", "WorkspaceDiffMode", "WorkspaceDiffResult", "WorkspaceSummary", "WorkspaceSummaryHostType", "WorkspacesApi", "WorkspacesCheckpoints", "WorkspacesCreateFileRequest", "WorkspacesDiffRequest", "WorkspacesGetWorkspaceResult", "WorkspacesListCheckpointsResult", "WorkspacesListFilesResult", "WorkspacesReadCheckpointRequest", "WorkspacesReadCheckpointResult", "WorkspacesReadFileRequest", "WorkspacesReadFileResult", "WorkspacesSaveLargePasteRequest", "WorkspacesSaveLargePasteResult", "WorkspacesWorkspaceDetailsHostType", "rpc_from_dict", "rpc_to_dict", ]