mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-04-29 03:00:45 -04:00
* deprecating recall action * fix integration tests * fix integration tests * refractor runtime to use async * remove search memory * rename .initialize to .ainit * draft of runtime image building (separate from img agnostic) * refractor runtime build into separate file and add unit tests for it * fix image agnostic tests * move `split_bash_commands` into a separate util file * fix bash pexcept parsing for env * refractor add_env_var from sandbox to runtime; add test runtime for env var, remove it from sandbox; * remove unclear comment * capture broader error * make `add_env_var` handle multiple export at the same time * add multi env var test * fix tests with new config * make runtime tests a separate ci to avoid full disk * Update Runtime README with architecture diagram and detailed explanations * update test * remove dependency of global config in sandbox test * fix sandbox typo * runtime tests does not need ghcr build now * remove download runtime img * remove dependency of global config in sandbox test * fix sandbox typo * try to free disk before running the tests * Update opendevin/runtime/client/README.md Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com> * Update opendevin/runtime/client/README.md Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com> * Update opendevin/runtime/client/README.md Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com> * try to reduce code duplication * Update opendevin/runtime/client/README.md Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com> * Update opendevin/runtime/client/README.md Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com> * Update opendevin/runtime/client/README.md Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com> * Update opendevin/runtime/client/README.md Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com> * Update opendevin/runtime/client/README.md Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com> * cleanup before setup * temporarily remove this enable lint test since env var are now handled by runtime * linter --------- Co-authored-by: OpenDevin <opendevin@all-hands.dev> Co-authored-by: Yufan Song <33971064+yufansong@users.noreply.github.com>
34 lines
876 B
Python
34 lines
876 B
Python
import copy
|
|
from abc import ABC, abstractmethod
|
|
|
|
from opendevin.core.config import SandboxConfig
|
|
from opendevin.core.schema import CancellableStream
|
|
from opendevin.runtime.plugins.mixin import PluginMixin
|
|
|
|
|
|
class Sandbox(ABC, PluginMixin):
|
|
_env: dict[str, str] = {}
|
|
is_initial_session: bool = True
|
|
|
|
def __init__(self, config: SandboxConfig):
|
|
self.config = copy.deepcopy(config)
|
|
self.initialize_plugins: bool = config.initialize_plugins
|
|
|
|
@abstractmethod
|
|
def execute(
|
|
self, cmd: str, stream: bool = False, timeout: int | None = None
|
|
) -> tuple[int, str | CancellableStream]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def close(self):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def copy_to(self, host_src: str, sandbox_dest: str, recursive: bool = False):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_working_directory(self):
|
|
pass
|