mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
refactored all relative paths to absolute paths (#3495)
This commit is contained in:
parent
d0df95ac62
commit
6487175a31
@ -1,14 +1,13 @@
|
|||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
from agenthub.micro.agent import MicroAgent
|
||||||
|
from agenthub.micro.registry import all_microagents
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
|
|
||||||
from .micro.agent import MicroAgent
|
|
||||||
from .micro.registry import all_microagents
|
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
|
||||||
from . import ( # noqa: E402
|
from agenthub import ( # noqa: E402
|
||||||
browsing_agent,
|
browsing_agent,
|
||||||
codeact_agent,
|
codeact_agent,
|
||||||
codeact_swe_agent,
|
codeact_swe_agent,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
from agenthub.browsing_agent.browsing_agent import BrowsingAgent
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
|
|
||||||
from .browsing_agent import BrowsingAgent
|
|
||||||
|
|
||||||
Agent.register('BrowsingAgent', BrowsingAgent)
|
Agent.register('BrowsingAgent', BrowsingAgent)
|
||||||
|
|||||||
@ -12,12 +12,11 @@ from browsergym.core.action.base import AbstractActionSet
|
|||||||
from browsergym.core.action.highlevel import HighLevelActionSet
|
from browsergym.core.action.highlevel import HighLevelActionSet
|
||||||
from browsergym.core.action.python import PythonActionSet
|
from browsergym.core.action.python import PythonActionSet
|
||||||
|
|
||||||
from openhands.runtime.browser.browser_env import BrowserEnv
|
from agenthub.browsing_agent.utils import (
|
||||||
|
|
||||||
from .utils import (
|
|
||||||
ParseError,
|
ParseError,
|
||||||
parse_html_tags_raise,
|
parse_html_tags_raise,
|
||||||
)
|
)
|
||||||
|
from openhands.runtime.browser.browser_env import BrowserEnv
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
from agenthub.codeact_agent.codeact_agent import CodeActAgent
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
|
|
||||||
from .codeact_agent import CodeActAgent
|
|
||||||
|
|
||||||
Agent.register('CodeActAgent', CodeActAgent)
|
Agent.register('CodeActAgent', CodeActAgent)
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
from agenthub.codeact_swe_agent.codeact_swe_agent import CodeActSWEAgent
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
|
|
||||||
from .codeact_swe_agent import CodeActSWEAgent
|
|
||||||
|
|
||||||
Agent.register('CodeActSWEAgent', CodeActSWEAgent)
|
Agent.register('CodeActSWEAgent', CodeActSWEAgent)
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
from agenthub.delegator_agent.agent import DelegatorAgent
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
|
|
||||||
from .agent import DelegatorAgent
|
|
||||||
|
|
||||||
Agent.register('DelegatorAgent', DelegatorAgent)
|
Agent.register('DelegatorAgent', DelegatorAgent)
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
from agenthub.dummy_agent.agent import DummyAgent
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
|
|
||||||
from .agent import DummyAgent
|
|
||||||
|
|
||||||
Agent.register('DummyAgent', DummyAgent)
|
Agent.register('DummyAgent', DummyAgent)
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
from jinja2 import BaseLoader, Environment
|
from jinja2 import BaseLoader, Environment
|
||||||
|
|
||||||
|
from agenthub.micro.instructions import instructions
|
||||||
|
from agenthub.micro.registry import all_microagents
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
from openhands.controller.state.state import State
|
from openhands.controller.state.state import State
|
||||||
from openhands.core.config import AgentConfig
|
from openhands.core.config import AgentConfig
|
||||||
@ -11,9 +13,6 @@ from openhands.events.serialization.event import event_to_memory
|
|||||||
from openhands.llm.llm import LLM
|
from openhands.llm.llm import LLM
|
||||||
from openhands.memory.history import ShortTermHistory
|
from openhands.memory.history import ShortTermHistory
|
||||||
|
|
||||||
from .instructions import instructions
|
|
||||||
from .registry import all_microagents
|
|
||||||
|
|
||||||
|
|
||||||
def parse_response(orig_response: str) -> Action:
|
def parse_response(orig_response: str) -> Action:
|
||||||
# attempt to load the JSON dict from the response
|
# attempt to load the JSON dict from the response
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
from agenthub.planner_agent.agent import PlannerAgent
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
|
|
||||||
from .agent import PlannerAgent
|
|
||||||
|
|
||||||
Agent.register('PlannerAgent', PlannerAgent)
|
Agent.register('PlannerAgent', PlannerAgent)
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
from agenthub.planner_agent.prompt import get_prompt_and_images
|
||||||
from agenthub.planner_agent.response_parser import PlannerResponseParser
|
from agenthub.planner_agent.response_parser import PlannerResponseParser
|
||||||
from openhands.controller.agent import Agent
|
from openhands.controller.agent import Agent
|
||||||
from openhands.controller.state.state import State
|
from openhands.controller.state.state import State
|
||||||
@ -6,8 +7,6 @@ from openhands.core.message import ImageContent, Message, TextContent
|
|||||||
from openhands.events.action import Action, AgentFinishAction
|
from openhands.events.action import Action, AgentFinishAction
|
||||||
from openhands.llm.llm import LLM
|
from openhands.llm.llm import LLM
|
||||||
|
|
||||||
from .prompt import get_prompt_and_images
|
|
||||||
|
|
||||||
|
|
||||||
class PlannerAgent(Agent):
|
class PlannerAgent(Agent):
|
||||||
VERSION = '1.0'
|
VERSION = '1.0'
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
from .base import Task
|
from evaluation.mint.tasks.base import Task
|
||||||
from .codegen import HumanEvalTask, MBPPTask
|
from evaluation.mint.tasks.codegen import HumanEvalTask, MBPPTask
|
||||||
from .reasoning import MultipleChoiceTask, ReasoningTask, TheoremqaTask
|
from evaluation.mint.tasks.reasoning import (
|
||||||
|
MultipleChoiceTask,
|
||||||
|
ReasoningTask,
|
||||||
|
TheoremqaTask,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'Task',
|
'Task',
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import logging
|
|||||||
|
|
||||||
from utils import check_correctness
|
from utils import check_correctness
|
||||||
|
|
||||||
from .base import Task
|
from evaluation.mint.tasks.base import Task
|
||||||
|
|
||||||
LOGGER = logging.getLogger('MINT')
|
LOGGER = logging.getLogger('MINT')
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from .agent_controller import AgentController
|
from openhands.controller.agent_controller import AgentController
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'AgentController',
|
'AgentController',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
from .action import ActionType
|
from openhands.core.schema.action import ActionType
|
||||||
from .agent import AgentState
|
from openhands.core.schema.agent import AgentState
|
||||||
from .config import ConfigType
|
from openhands.core.schema.config import ConfigType
|
||||||
from .observation import ObservationType
|
from openhands.core.schema.observation import ObservationType
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'ActionType',
|
'ActionType',
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
from .singleton import Singleton
|
from openhands.core.utils.singleton import Singleton
|
||||||
|
|
||||||
__all__ = ['Singleton']
|
__all__ = ['Singleton']
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from .event import Event, EventSource
|
from openhands.events.event import Event, EventSource
|
||||||
from .stream import EventStream, EventStreamSubscriber
|
from openhands.events.stream import EventStream, EventStreamSubscriber
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'Event',
|
'Event',
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
from .action import Action, ActionConfirmationStatus
|
from openhands.events.action.action import Action, ActionConfirmationStatus
|
||||||
from .agent import (
|
from openhands.events.action.agent import (
|
||||||
AgentDelegateAction,
|
AgentDelegateAction,
|
||||||
AgentFinishAction,
|
AgentFinishAction,
|
||||||
AgentRejectAction,
|
AgentRejectAction,
|
||||||
AgentSummarizeAction,
|
AgentSummarizeAction,
|
||||||
ChangeAgentStateAction,
|
ChangeAgentStateAction,
|
||||||
)
|
)
|
||||||
from .browse import BrowseInteractiveAction, BrowseURLAction
|
from openhands.events.action.browse import BrowseInteractiveAction, BrowseURLAction
|
||||||
from .commands import CmdRunAction, IPythonRunCellAction
|
from openhands.events.action.commands import CmdRunAction, IPythonRunCellAction
|
||||||
from .empty import NullAction
|
from openhands.events.action.empty import NullAction
|
||||||
from .files import FileReadAction, FileWriteAction
|
from openhands.events.action.files import FileReadAction, FileWriteAction
|
||||||
from .message import MessageAction
|
from openhands.events.action.message import MessageAction
|
||||||
from .tasks import AddTaskAction, ModifyTaskAction
|
from openhands.events.action.tasks import AddTaskAction, ModifyTaskAction
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'Action',
|
'Action',
|
||||||
|
|||||||
@ -2,8 +2,7 @@ from dataclasses import dataclass, field
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from openhands.core.schema import ActionType
|
from openhands.core.schema import ActionType
|
||||||
|
from openhands.events.action.action import Action
|
||||||
from .action import Action
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -2,8 +2,7 @@ from dataclasses import dataclass
|
|||||||
from typing import ClassVar
|
from typing import ClassVar
|
||||||
|
|
||||||
from openhands.core.schema import ActionType
|
from openhands.core.schema import ActionType
|
||||||
|
from openhands.events.action.action import Action, ActionSecurityRisk
|
||||||
from .action import Action, ActionSecurityRisk
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -2,8 +2,11 @@ from dataclasses import dataclass
|
|||||||
from typing import ClassVar
|
from typing import ClassVar
|
||||||
|
|
||||||
from openhands.core.schema import ActionType
|
from openhands.core.schema import ActionType
|
||||||
|
from openhands.events.action.action import (
|
||||||
from .action import Action, ActionConfirmationStatus, ActionSecurityRisk
|
Action,
|
||||||
|
ActionConfirmationStatus,
|
||||||
|
ActionSecurityRisk,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ActionType
|
from openhands.core.schema import ActionType
|
||||||
|
from openhands.events.action.action import Action
|
||||||
from .action import Action
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -2,8 +2,7 @@ from dataclasses import dataclass
|
|||||||
from typing import ClassVar
|
from typing import ClassVar
|
||||||
|
|
||||||
from openhands.core.schema import ActionType
|
from openhands.core.schema import ActionType
|
||||||
|
from openhands.events.action.action import Action, ActionSecurityRisk
|
||||||
from .action import Action, ActionSecurityRisk
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ActionType
|
from openhands.core.schema import ActionType
|
||||||
|
from openhands.events.action.action import Action, ActionSecurityRisk
|
||||||
from .action import Action, ActionSecurityRisk
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from openhands.core.schema import ActionType
|
from openhands.core.schema import ActionType
|
||||||
|
from openhands.events.action.action import Action
|
||||||
from .action import Action
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,13 +1,16 @@
|
|||||||
from .agent import AgentStateChangedObservation
|
from openhands.events.observation.agent import AgentStateChangedObservation
|
||||||
from .browse import BrowserOutputObservation
|
from openhands.events.observation.browse import BrowserOutputObservation
|
||||||
from .commands import CmdOutputObservation, IPythonRunCellObservation
|
from openhands.events.observation.commands import (
|
||||||
from .delegate import AgentDelegateObservation
|
CmdOutputObservation,
|
||||||
from .empty import NullObservation
|
IPythonRunCellObservation,
|
||||||
from .error import ErrorObservation
|
)
|
||||||
from .files import FileReadObservation, FileWriteObservation
|
from openhands.events.observation.delegate import AgentDelegateObservation
|
||||||
from .observation import Observation
|
from openhands.events.observation.empty import NullObservation
|
||||||
from .reject import UserRejectObservation
|
from openhands.events.observation.error import ErrorObservation
|
||||||
from .success import SuccessObservation
|
from openhands.events.observation.files import FileReadObservation, FileWriteObservation
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
|
from openhands.events.observation.reject import UserRejectObservation
|
||||||
|
from openhands.events.observation.success import SuccessObservation
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'Observation',
|
'Observation',
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from openhands.core.schema import ObservationType
|
from openhands.core.schema import ObservationType
|
||||||
|
from openhands.events.observation.observation import Observation
|
||||||
from .observation import Observation
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
from .action import (
|
from openhands.events.serialization.action import (
|
||||||
action_from_dict,
|
action_from_dict,
|
||||||
)
|
)
|
||||||
from .event import (
|
from openhands.events.serialization.event import (
|
||||||
event_from_dict,
|
event_from_dict,
|
||||||
event_to_dict,
|
event_to_dict,
|
||||||
event_to_memory,
|
event_to_memory,
|
||||||
)
|
)
|
||||||
from .observation import (
|
from openhands.events.serialization.observation import (
|
||||||
observation_from_dict,
|
observation_from_dict,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,9 @@ from datetime import datetime
|
|||||||
|
|
||||||
from openhands.events import Event, EventSource
|
from openhands.events import Event, EventSource
|
||||||
from openhands.events.observation.observation import Observation
|
from openhands.events.observation.observation import Observation
|
||||||
|
from openhands.events.serialization.action import action_from_dict
|
||||||
from .action import action_from_dict
|
from openhands.events.serialization.observation import observation_from_dict
|
||||||
from .observation import observation_from_dict
|
from openhands.events.serialization.utils import remove_fields
|
||||||
from .utils import remove_fields
|
|
||||||
|
|
||||||
# TODO: move `content` into `extras`
|
# TODO: move `content` into `extras`
|
||||||
TOP_KEYS = ['id', 'timestamp', 'source', 'message', 'cause', 'action', 'observation']
|
TOP_KEYS = ['id', 'timestamp', 'source', 'message', 'cause', 'action', 'observation']
|
||||||
|
|||||||
@ -6,11 +6,10 @@ from typing import Callable, Iterable
|
|||||||
|
|
||||||
from openhands.core.logger import openhands_logger as logger
|
from openhands.core.logger import openhands_logger as logger
|
||||||
from openhands.core.utils import json
|
from openhands.core.utils import json
|
||||||
|
from openhands.events.event import Event, EventSource
|
||||||
from openhands.events.serialization.event import event_from_dict, event_to_dict
|
from openhands.events.serialization.event import event_from_dict, event_to_dict
|
||||||
from openhands.storage import FileStore
|
from openhands.storage import FileStore
|
||||||
|
|
||||||
from .event import Event, EventSource
|
|
||||||
|
|
||||||
|
|
||||||
class EventStreamSubscriber(str, Enum):
|
class EventStreamSubscriber(str, Enum):
|
||||||
AGENT_CONTROLLER = 'agent_controller'
|
AGENT_CONTROLLER = 'agent_controller'
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from .condenser import MemoryCondenser
|
from openhands.memory.condenser import MemoryCondenser
|
||||||
from .history import ShortTermHistory
|
from openhands.memory.history import ShortTermHistory
|
||||||
from .memory import LongTermMemory
|
from openhands.memory.memory import LongTermMemory
|
||||||
|
|
||||||
__all__ = ['LongTermMemory', 'ShortTermHistory', 'MemoryCondenser']
|
__all__ = ['LongTermMemory', 'ShortTermHistory', 'MemoryCondenser']
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
from .e2b.sandbox import E2BBox
|
from openhands.runtime.e2b.sandbox import E2BBox
|
||||||
|
|
||||||
|
|
||||||
def get_runtime_cls(name: str):
|
def get_runtime_cls(name: str):
|
||||||
# Local imports to avoid circular imports
|
# Local imports to avoid circular imports
|
||||||
if name == 'eventstream':
|
if name == 'eventstream':
|
||||||
from .client.runtime import EventStreamRuntime
|
from openhands.runtime.client.runtime import EventStreamRuntime
|
||||||
|
|
||||||
return EventStreamRuntime
|
return EventStreamRuntime
|
||||||
elif name == 'e2b':
|
elif name == 'e2b':
|
||||||
from .e2b.runtime import E2BRuntime
|
from openhands.runtime.e2b.runtime import E2BRuntime
|
||||||
|
|
||||||
return E2BRuntime
|
return E2BRuntime
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
from .utils import browse
|
from openhands.runtime.browser.utils import browse
|
||||||
|
|
||||||
__all__ = ['browse']
|
__all__ = ['browse']
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from .base import RuntimeBuilder
|
from openhands.runtime.builder.base import RuntimeBuilder
|
||||||
from .docker import DockerRuntimeBuilder
|
from openhands.runtime.builder.docker import DockerRuntimeBuilder
|
||||||
|
|
||||||
__all__ = ['RuntimeBuilder', 'DockerRuntimeBuilder']
|
__all__ = ['RuntimeBuilder', 'DockerRuntimeBuilder']
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import docker
|
import docker
|
||||||
|
|
||||||
from openhands.core.logger import openhands_logger as logger
|
from openhands.core.logger import openhands_logger as logger
|
||||||
|
from openhands.runtime.builder.base import RuntimeBuilder
|
||||||
from .base import RuntimeBuilder
|
|
||||||
|
|
||||||
|
|
||||||
class DockerRuntimeBuilder(RuntimeBuilder):
|
class DockerRuntimeBuilder(RuntimeBuilder):
|
||||||
|
|||||||
@ -10,12 +10,11 @@ from openhands.events.observation import (
|
|||||||
Observation,
|
Observation,
|
||||||
)
|
)
|
||||||
from openhands.events.stream import EventStream
|
from openhands.events.stream import EventStream
|
||||||
|
from openhands.runtime.e2b.filestore import E2BFileStore
|
||||||
|
from openhands.runtime.e2b.sandbox import E2BSandbox
|
||||||
from openhands.runtime.plugins import PluginRequirement
|
from openhands.runtime.plugins import PluginRequirement
|
||||||
from openhands.runtime.runtime import Runtime
|
from openhands.runtime.runtime import Runtime
|
||||||
|
from openhands.runtime.utils.files import insert_lines, read_lines
|
||||||
from ..utils.files import insert_lines, read_lines
|
|
||||||
from .filestore import E2BFileStore
|
|
||||||
from .sandbox import E2BSandbox
|
|
||||||
|
|
||||||
|
|
||||||
class E2BRuntime(Runtime):
|
class E2BRuntime(Runtime):
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
# Requirements
|
# Requirements
|
||||||
from .agent_skills import AgentSkillsPlugin, AgentSkillsRequirement
|
from openhands.runtime.plugins.agent_skills import (
|
||||||
from .jupyter import JupyterPlugin, JupyterRequirement
|
AgentSkillsPlugin,
|
||||||
from .requirement import Plugin, PluginRequirement
|
AgentSkillsRequirement,
|
||||||
|
)
|
||||||
|
from openhands.runtime.plugins.jupyter import JupyterPlugin, JupyterRequirement
|
||||||
|
from openhands.runtime.plugins.requirement import Plugin, PluginRequirement
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'Plugin',
|
'Plugin',
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
from openhands.runtime.plugins.agent_skills import agentskills
|
||||||
from openhands.runtime.plugins.requirement import Plugin, PluginRequirement
|
from openhands.runtime.plugins.requirement import Plugin, PluginRequirement
|
||||||
|
|
||||||
from . import agentskills
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class AgentSkillsRequirement(PluginRequirement):
|
class AgentSkillsRequirement(PluginRequirement):
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
from inspect import signature
|
from inspect import signature
|
||||||
|
|
||||||
from . import file_ops, file_reader
|
from openhands.runtime.plugins.agent_skills import file_ops, file_reader
|
||||||
from .utils.dependency import import_functions
|
from openhands.runtime.plugins.agent_skills.utils.dependency import import_functions
|
||||||
|
|
||||||
import_functions(
|
import_functions(
|
||||||
module=file_ops, function_names=file_ops.__all__, target_globals=globals()
|
module=file_ops, function_names=file_ops.__all__, target_globals=globals()
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from ..utils.dependency import import_functions
|
from openhands.runtime.plugins.agent_skills.file_ops import file_ops
|
||||||
from . import file_ops
|
from openhands.runtime.plugins.agent_skills.utils.dependency import import_functions
|
||||||
|
|
||||||
import_functions(
|
import_functions(
|
||||||
module=file_ops, function_names=file_ops.__all__, target_globals=globals()
|
module=file_ops, function_names=file_ops.__all__, target_globals=globals()
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import tempfile
|
|||||||
if __package__ is None or __package__ == '':
|
if __package__ is None or __package__ == '':
|
||||||
from aider import Linter
|
from aider import Linter
|
||||||
else:
|
else:
|
||||||
from ..utils.aider import Linter
|
from openhands.runtime.plugins.agent_skills.utils.aider import Linter
|
||||||
|
|
||||||
CURRENT_FILE: str | None = None
|
CURRENT_FILE: str | None = None
|
||||||
CURRENT_LINE = 1
|
CURRENT_LINE = 1
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from ..utils.dependency import import_functions
|
from openhands.runtime.plugins.agent_skills.file_reader import file_readers
|
||||||
from . import file_readers
|
from openhands.runtime.plugins.agent_skills.utils.dependency import import_functions
|
||||||
|
|
||||||
import_functions(
|
import_functions(
|
||||||
module=file_readers, function_names=file_readers.__all__, target_globals=globals()
|
module=file_readers, function_names=file_readers.__all__, target_globals=globals()
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import PyPDF2
|
|||||||
from pptx import Presentation
|
from pptx import Presentation
|
||||||
from pylatexenc.latex2text import LatexNodes2Text
|
from pylatexenc.latex2text import LatexNodes2Text
|
||||||
|
|
||||||
from ..utils.config import (
|
from openhands.runtime.plugins.agent_skills.utils.config import (
|
||||||
_get_max_token,
|
_get_max_token,
|
||||||
_get_openai_api_key,
|
_get_openai_api_key,
|
||||||
_get_openai_base_url,
|
_get_openai_base_url,
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
if __package__ is None or __package__ == '':
|
if __package__ is None or __package__ == '':
|
||||||
from linter import Linter, LintResult
|
from linter import Linter, LintResult
|
||||||
else:
|
else:
|
||||||
from .linter import Linter, LintResult
|
from openhands.runtime.plugins.agent_skills.utils.aider.linter import (
|
||||||
|
Linter,
|
||||||
|
LintResult,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = ['Linter', 'LintResult']
|
__all__ = ['Linter', 'LintResult']
|
||||||
|
|||||||
@ -5,11 +5,10 @@ from dataclasses import dataclass
|
|||||||
from openhands.core.logger import openhands_logger as logger
|
from openhands.core.logger import openhands_logger as logger
|
||||||
from openhands.events.action import Action, IPythonRunCellAction
|
from openhands.events.action import Action, IPythonRunCellAction
|
||||||
from openhands.events.observation import IPythonRunCellObservation
|
from openhands.events.observation import IPythonRunCellObservation
|
||||||
|
from openhands.runtime.plugins.jupyter.execute_server import JupyterKernel
|
||||||
from openhands.runtime.plugins.requirement import Plugin, PluginRequirement
|
from openhands.runtime.plugins.requirement import Plugin, PluginRequirement
|
||||||
from openhands.runtime.utils import find_available_tcp_port
|
from openhands.runtime.utils import find_available_tcp_port
|
||||||
|
|
||||||
from .execute_server import JupyterKernel
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class JupyterRequirement(PluginRequirement):
|
class JupyterRequirement(PluginRequirement):
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from .bash import split_bash_commands
|
from openhands.runtime.utils.bash import split_bash_commands
|
||||||
from .system import find_available_tcp_port
|
from openhands.runtime.utils.system import find_available_tcp_port
|
||||||
|
|
||||||
__all__ = ['find_available_tcp_port', 'split_bash_commands']
|
__all__ = ['find_available_tcp_port', 'split_bash_commands']
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from .analyzer import SecurityAnalyzer
|
from openhands.security.analyzer import SecurityAnalyzer
|
||||||
from .invariant.analyzer import InvariantAnalyzer
|
from openhands.security.invariant.analyzer import InvariantAnalyzer
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'SecurityAnalyzer',
|
'SecurityAnalyzer',
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from .analyzer import InvariantAnalyzer
|
from openhands.security.invariant.analyzer import InvariantAnalyzer
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'InvariantAnalyzer',
|
'InvariantAnalyzer',
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
from .auth import get_sid_from_token, sign_token
|
from openhands.server.auth.auth import get_sid_from_token, sign_token
|
||||||
|
|
||||||
__all__ = ['get_sid_from_token', 'sign_token']
|
__all__ = ['get_sid_from_token', 'sign_token']
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from .manager import SessionManager
|
from openhands.server.session.manager import SessionManager
|
||||||
from .session import Session
|
from openhands.server.session.session import Session
|
||||||
|
|
||||||
__all__ = ['Session', 'SessionManager']
|
__all__ = ['Session', 'SessionManager']
|
||||||
|
|||||||
@ -5,10 +5,9 @@ from fastapi import WebSocket
|
|||||||
|
|
||||||
from openhands.core.config import AppConfig
|
from openhands.core.config import AppConfig
|
||||||
from openhands.core.logger import openhands_logger as logger
|
from openhands.core.logger import openhands_logger as logger
|
||||||
|
from openhands.server.session.session import Session
|
||||||
from openhands.storage.files import FileStore
|
from openhands.storage.files import FileStore
|
||||||
|
|
||||||
from .session import Session
|
|
||||||
|
|
||||||
|
|
||||||
class SessionManager:
|
class SessionManager:
|
||||||
_sessions: dict[str, Session] = {}
|
_sessions: dict[str, Session] = {}
|
||||||
|
|||||||
@ -20,10 +20,9 @@ from openhands.events.observation import (
|
|||||||
from openhands.events.serialization import event_from_dict, event_to_dict
|
from openhands.events.serialization import event_from_dict, event_to_dict
|
||||||
from openhands.events.stream import EventStreamSubscriber
|
from openhands.events.stream import EventStreamSubscriber
|
||||||
from openhands.llm.llm import LLM
|
from openhands.llm.llm import LLM
|
||||||
|
from openhands.server.session.agent import AgentSession
|
||||||
from openhands.storage.files import FileStore
|
from openhands.storage.files import FileStore
|
||||||
|
|
||||||
from .agent import AgentSession
|
|
||||||
|
|
||||||
DEL_DELT_SEC = 60 * 60 * 5
|
DEL_DELT_SEC = 60 * 60 * 5
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
from .files import FileStore
|
from openhands.storage.files import FileStore
|
||||||
from .local import LocalFileStore
|
from openhands.storage.local import LocalFileStore
|
||||||
from .memory import InMemoryFileStore
|
from openhands.storage.memory import InMemoryFileStore
|
||||||
from .s3 import S3FileStore
|
from openhands.storage.s3 import S3FileStore
|
||||||
|
|
||||||
|
|
||||||
def get_file_store(file_store: str, file_store_path: str | None = None) -> FileStore:
|
def get_file_store(file_store: str, file_store_path: str | None = None) -> FileStore:
|
||||||
|
|||||||
@ -2,8 +2,7 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from openhands.core.logger import openhands_logger as logger
|
from openhands.core.logger import openhands_logger as logger
|
||||||
|
from openhands.storage.files import FileStore
|
||||||
from .files import FileStore
|
|
||||||
|
|
||||||
|
|
||||||
class LocalFileStore(FileStore):
|
class LocalFileStore(FileStore):
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from openhands.core.logger import openhands_logger as logger
|
from openhands.core.logger import openhands_logger as logger
|
||||||
|
from openhands.storage.files import FileStore
|
||||||
from .files import FileStore
|
|
||||||
|
|
||||||
|
|
||||||
class InMemoryFileStore(FileStore):
|
class InMemoryFileStore(FileStore):
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import os
|
|||||||
|
|
||||||
from minio import Minio
|
from minio import Minio
|
||||||
|
|
||||||
from .files import FileStore
|
from openhands.storage.files import FileStore
|
||||||
|
|
||||||
AWS_S3_ENDPOINT = 's3.amazonaws.com'
|
AWS_S3_ENDPOINT = 's3.amazonaws.com'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user