File size: 1,050 Bytes
7698d12
 
 
 
 
 
 
9e98d70
 
 
 
7698d12
 
9e98d70
 
7698d12
 
 
 
 
 
 
9e98d70
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""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}")