File size: 1,079 Bytes
fd986d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15de0e3
fd986d0
 
15de0e3
fd986d0
15de0e3
fd986d0
 
 
15de0e3
 
 
 
 
 
 
 
fd986d0
 
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
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

"""Models for the Terminus environment."""

from __future__ import annotations

from openenv.core.env_server.types import State
from pydantic import BaseModel, Field


class CommandResult(BaseModel):
    """Outcome of one shell command run inside the E2B sandbox."""

    command: str
    output: str = ""
    error: str | None = None
    success: bool = True


class TerminusState(State):
    """Per-session state for the single-tool Terminus environment."""

    sandbox_id: str | None = None
    setup_results: list[CommandResult] = Field(default_factory=list)
    verify_commands: list[str] = Field(default_factory=list)
    verify_results: list[CommandResult] = Field(default_factory=list)
    commands: list[CommandResult] = Field(default_factory=list)
    submitted_answer: str | None = None
    last_reward: float | None = None
    last_error: str | None = None