openenv/coding_env
21
1# Copyright (c) Meta Platforms, Inc. and affiliates.2# All rights reserved.3#4# This source code is licensed under the BSD-style license found in the5# LICENSE file in the root directory of this source tree.6 7"""Core environment interfaces and types."""8 9from .base_transforms import CompositeTransform, NullTransform10from .exceptions import (11 ConcurrencyConfigurationError,12 EnvironmentFactoryError,13 OpenEnvError,14 SessionCapacityError,15 SessionCreationError,16 SessionNotFoundError,17)18from .http_server import create_app, create_fastapi_app, HTTPEnvServer19from .interfaces import Environment, Message, ModelTokenizer, Transform20 21try:22 from .mcp_environment import MCPEnvironment23except ModuleNotFoundError:24 MCPEnvironment = None # type: ignore[assignment]25 26from .mcp_types import (27 CallToolAction,28 CallToolObservation,29 JsonRpcError,30 # JSON-RPC types31 JsonRpcErrorCode,32 JsonRpcRequest,33 JsonRpcResponse,34 ListToolsAction,35 ListToolsObservation,36 McpMethod,37 RESERVED_TOOL_NAMES,38 Tool,39 ToolError,40 ToolErrorType,41 WSMCPMessage,42 WSMCPResponse,43)44from .route_config import GetEndpointConfig45from .serialization import (46 deserialize_action,47 deserialize_action_with_preprocessing,48 serialize_observation,49)50from .types import (51 Action,52 BaseMessage,53 ConcurrencyConfig,54 HealthResponse,55 HealthStatus,56 Observation,57 SchemaResponse,58 ServerCapacityStatus,59 ServerMode,60 SessionInfo,61 State,62 WSCloseMessage,63 WSErrorCode,64 WSErrorResponse,65 WSIncomingMessage,66 WSObservationResponse,67 WSResetMessage,68 WSStateMessage,69 WSStateResponse,70 WSStepMessage,71)72 73try:74 from .web_interface import create_web_interface_app, WebInterfaceManager75except ModuleNotFoundError:76 create_web_interface_app = None # type: ignore[assignment]77 WebInterfaceManager = None # type: ignore[assignment]78 79__all__ = [80 # Core interfaces81 "Environment",82 "Transform",83 "Message",84 "ModelTokenizer",85 # Types86 "Action",87 "Observation",88 "State",89 "SchemaResponse",90 "HealthResponse",91 # Enums92 "HealthStatus",93 "ServerMode",94 "WSErrorCode",95 # WebSocket message types96 "BaseMessage",97 "WSIncomingMessage",98 "WSResetMessage",99 "WSStepMessage",100 "WSStateMessage",101 "WSCloseMessage",102 "WSObservationResponse",103 "WSStateResponse",104 "WSErrorResponse",105 # Concurrency types106 "ConcurrencyConfig",107 "ServerCapacityStatus",108 "SessionInfo",109 # Exceptions110 "OpenEnvError",111 "ConcurrencyConfigurationError",112 "SessionCapacityError",113 "SessionNotFoundError",114 "SessionCreationError",115 "EnvironmentFactoryError",116 # Base transforms117 "CompositeTransform",118 "NullTransform",119 # HTTP Server120 "HTTPEnvServer",121 "create_app",122 "create_fastapi_app",123 # Web Interface124 "create_web_interface_app",125 "WebInterfaceManager",126 # Serialization utilities127 "deserialize_action",128 "deserialize_action_with_preprocessing",129 "serialize_observation",130 # Route configuration131 "GetEndpointConfig",132 # MCP types133 "Tool",134 "ToolError",135 "ToolErrorType",136 "ListToolsAction",137 "CallToolAction",138 "ListToolsObservation",139 "CallToolObservation",140 "WSMCPMessage",141 "WSMCPResponse",142 "RESERVED_TOOL_NAMES",143 "MCPEnvironment",144 # JSON-RPC types145 "JsonRpcErrorCode",146 "JsonRpcError",147 "JsonRpcRequest",148 "JsonRpcResponse",149 "McpMethod",150]151 