mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-04-29 03:00:45 -04:00
* rearrange workspace_dir and max_step as arguments to controller * remove unused output * abstract each action into dataclass * move actions * fix action import * move cmd manager and change method to private * move controller * rename action folder * add state * a draft of Controller & new agent abstraction * add agent actions * remove controller file * add observation to perform a refractor on langchains agent * revert to make this compatible via translation * fix typo and translate error * add error to observation * index thought as dict * refractor controller * fix circular dependency caused by type hint * add runnable attribute to agent * add mixin to denote executable * change baseclass * make file read/write action compatible w/ docker directory * remove event * fix some merge issue * fix sandbox w/ permission issue * cleanup history abstraction since langchains agent is not really using it * tweak to make langchains agent working * make all actions return observation * fix missing import * add echo action for agent * add error code to cmd output obs * make cmd manager returns cmd output obs * fix codeact agent to make it work * fix all ruff issue * fix mypy * add import agenthub back * add message for Action attribute (migrate from previous event) * fix typo * fix instruction setting * fix instruction setting * attempt to fix session * ruff fix * add .to_dict method for base and observation * add message for recall * try to simplify the state_updated_info with tuple of action and obs * update_info to Tuple[Action, Observation] * make codeact agent and langchains compatible with Tuple[Action, Observation] * fix ruff * fix ruff * change to base path to fix minimal langchains agent * add NullAction to potentially handle for chat scenario * Update opendevin/controller/command_manager.py Co-authored-by: Robert Brennan <accounts@rbren.io> * fix event args * set the default workspace to "workspace" * make directory relative (so it does not show up to agent in File*Action) * fix typo * await to yield for sending observation * fix message format --------- Co-authored-by: Robert Brennan <accounts@rbren.io>
33 lines
882 B
Python
33 lines
882 B
Python
from dataclasses import dataclass
|
|
from typing import TYPE_CHECKING
|
|
|
|
from .base import ExecutableAction
|
|
|
|
if TYPE_CHECKING:
|
|
from opendevin.controller import AgentController
|
|
from opendevin.observation import CmdOutputObservation
|
|
|
|
|
|
@dataclass
|
|
class CmdRunAction(ExecutableAction):
|
|
command: str
|
|
background: bool = False
|
|
|
|
def run(self, controller: "AgentController") -> "CmdOutputObservation":
|
|
return controller.command_manager.run_command(self.command, self.background)
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f"Running command: {self.command}"
|
|
|
|
@dataclass
|
|
class CmdKillAction(ExecutableAction):
|
|
id: int
|
|
|
|
def run(self, controller: "AgentController") -> "CmdOutputObservation":
|
|
return controller.command_manager.kill_command(self.id)
|
|
|
|
@property
|
|
def message(self) -> str:
|
|
return f"Killing command: {self.id}"
|