Spaces:
Sleeping
Sleeping
| """OpenEnv OpenCode environment. | |
| Exposes a single MCP tool ``run_rollout`` that spawns an E2B sandbox, runs | |
| the OpenCode CLI agent against a caller-supplied LLM endpoint, runs the | |
| caller-supplied verifier script, and returns reward + proxy trace + | |
| workdir contents as a JSON-serialized :class:`RolloutResult`. | |
| The directory name (``openenv``) matches the installed ``openenv-core`` | |
| namespace package, so we use lazy ``__getattr__`` resolution to avoid | |
| eager imports that would collide with the installed package when this | |
| folder is on ``sys.path`` (pytest rootdir, etc.). | |
| """ | |
| from __future__ import annotations | |
| __all__ = [ | |
| "OpenCodeEnv", | |
| "OpenCodeState", | |
| "RolloutResult", | |
| "RolloutTurn", | |
| ] | |
| def __getattr__(name): | |
| if name == "OpenCodeEnv": | |
| from .client import OpenCodeEnv | |
| return OpenCodeEnv | |
| if name in ("OpenCodeState", "RolloutResult", "RolloutTurn"): | |
| from . import models | |
| return getattr(models, name) | |
| raise AttributeError(f"module 'opencode_env_server' has no attribute {name!r}") | |