File size: 2,680 Bytes
be9f416
6759502
be9f416
 
 
 
6759502
 
 
be9f416
6759502
be9f416
 
 
6759502
92e9724
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6759502
 
be9f416
6759502
be9f416
 
 
 
92e9724
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
"""Data models for the Ontology Architect research environment."""

try:
    from openenv.core.env_server.types import Action, Observation
except ImportError:  # pragma: no cover - older OpenEnv compatibility.
    from openenv_core.env_server.types import Action, Observation


class OntologyArchitectAction(Action):
    """A full Python theory-module rewrite submitted by the agent."""

    theory_module: str
    revision_note: str = ""
    paradigm_shift_claim: bool = False

    def __init__(
        self,
        theory_module: str,
        revision_note: str = "",
        paradigm_shift_claim: bool = False,
        **kwargs,
    ):
        # Newer OpenEnv variants accept subclass fields in __init__; older ones don't.
        try:
            super().__init__(
                theory_module=theory_module,
                revision_note=revision_note,
                paradigm_shift_claim=paradigm_shift_claim,
                **kwargs,
            )
            return
        except TypeError:
            pass

        try:
            super().__init__(**kwargs)
        except TypeError:
            super().__init__()
            for key, value in kwargs.items():
                object.__setattr__(self, key, value)

        object.__setattr__(self, "theory_module", theory_module)
        object.__setattr__(self, "revision_note", revision_note)
        object.__setattr__(self, "paradigm_shift_claim", paradigm_shift_claim)


class OntologyArchitectObservation(Observation):
    """Schema-guided text observation returned to the theory-writing agent."""

    text: str
    sensor_log: str = ""
    execution_output: str = ""
    peer_review: str = ""

    def __init__(
        self,
        text: str,
        sensor_log: str = "",
        execution_output: str = "",
        peer_review: str = "",
        **kwargs,
    ):
        # Newer OpenEnv variants accept subclass fields in __init__; older ones don't.
        try:
            super().__init__(
                text=text,
                sensor_log=sensor_log,
                execution_output=execution_output,
                peer_review=peer_review,
                **kwargs,
            )
            return
        except TypeError:
            pass

        try:
            super().__init__(**kwargs)
        except TypeError:
            super().__init__()
            for key, value in kwargs.items():
                object.__setattr__(self, key, value)

        object.__setattr__(self, "text", text)
        object.__setattr__(self, "sensor_log", sensor_log)
        object.__setattr__(self, "execution_output", execution_output)
        object.__setattr__(self, "peer_review", peer_review)