diff --git a/agenthub/__init__.py b/agenthub/__init__.py index 4c476b43be..d91f2d3ec2 100644 --- a/agenthub/__init__.py +++ b/agenthub/__init__.py @@ -1,14 +1,13 @@ 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 .micro.agent import MicroAgent -from .micro.registry import all_microagents - load_dotenv() -from . import ( # noqa: E402 +from agenthub import ( # noqa: E402 browsing_agent, codeact_agent, codeact_swe_agent, diff --git a/agenthub/browsing_agent/__init__.py b/agenthub/browsing_agent/__init__.py index 6f25e3da81..5b32e8c826 100644 --- a/agenthub/browsing_agent/__init__.py +++ b/agenthub/browsing_agent/__init__.py @@ -1,5 +1,4 @@ +from agenthub.browsing_agent.browsing_agent import BrowsingAgent from openhands.controller.agent import Agent -from .browsing_agent import BrowsingAgent - Agent.register('BrowsingAgent', BrowsingAgent) diff --git a/agenthub/browsing_agent/prompt.py b/agenthub/browsing_agent/prompt.py index aa0e6b929f..468c1d52d3 100644 --- a/agenthub/browsing_agent/prompt.py +++ b/agenthub/browsing_agent/prompt.py @@ -12,12 +12,11 @@ from browsergym.core.action.base import AbstractActionSet from browsergym.core.action.highlevel import HighLevelActionSet from browsergym.core.action.python import PythonActionSet -from openhands.runtime.browser.browser_env import BrowserEnv - -from .utils import ( +from agenthub.browsing_agent.utils import ( ParseError, parse_html_tags_raise, ) +from openhands.runtime.browser.browser_env import BrowserEnv @dataclass diff --git a/agenthub/codeact_agent/__init__.py b/agenthub/codeact_agent/__init__.py index c8a924dc4b..db780e24d0 100644 --- a/agenthub/codeact_agent/__init__.py +++ b/agenthub/codeact_agent/__init__.py @@ -1,5 +1,4 @@ +from agenthub.codeact_agent.codeact_agent import CodeActAgent from openhands.controller.agent import Agent -from .codeact_agent import CodeActAgent - Agent.register('CodeActAgent', CodeActAgent) diff --git a/agenthub/codeact_swe_agent/__init__.py b/agenthub/codeact_swe_agent/__init__.py index b634777fbe..b0b3d3aae9 100644 --- a/agenthub/codeact_swe_agent/__init__.py +++ b/agenthub/codeact_swe_agent/__init__.py @@ -1,5 +1,4 @@ +from agenthub.codeact_swe_agent.codeact_swe_agent import CodeActSWEAgent from openhands.controller.agent import Agent -from .codeact_swe_agent import CodeActSWEAgent - Agent.register('CodeActSWEAgent', CodeActSWEAgent) diff --git a/agenthub/delegator_agent/__init__.py b/agenthub/delegator_agent/__init__.py index 16b6705763..4c420816fd 100644 --- a/agenthub/delegator_agent/__init__.py +++ b/agenthub/delegator_agent/__init__.py @@ -1,5 +1,4 @@ +from agenthub.delegator_agent.agent import DelegatorAgent from openhands.controller.agent import Agent -from .agent import DelegatorAgent - Agent.register('DelegatorAgent', DelegatorAgent) diff --git a/agenthub/dummy_agent/__init__.py b/agenthub/dummy_agent/__init__.py index 0a63c69129..5e7c39b7f5 100644 --- a/agenthub/dummy_agent/__init__.py +++ b/agenthub/dummy_agent/__init__.py @@ -1,5 +1,4 @@ +from agenthub.dummy_agent.agent import DummyAgent from openhands.controller.agent import Agent -from .agent import DummyAgent - Agent.register('DummyAgent', DummyAgent) diff --git a/agenthub/micro/agent.py b/agenthub/micro/agent.py index d444e121bc..4645d38cd9 100644 --- a/agenthub/micro/agent.py +++ b/agenthub/micro/agent.py @@ -1,5 +1,7 @@ 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.state.state import State 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.memory.history import ShortTermHistory -from .instructions import instructions -from .registry import all_microagents - def parse_response(orig_response: str) -> Action: # attempt to load the JSON dict from the response diff --git a/agenthub/planner_agent/__init__.py b/agenthub/planner_agent/__init__.py index 385df5c001..3b97ae3b3c 100644 --- a/agenthub/planner_agent/__init__.py +++ b/agenthub/planner_agent/__init__.py @@ -1,5 +1,4 @@ +from agenthub.planner_agent.agent import PlannerAgent from openhands.controller.agent import Agent -from .agent import PlannerAgent - Agent.register('PlannerAgent', PlannerAgent) diff --git a/agenthub/planner_agent/agent.py b/agenthub/planner_agent/agent.py index 7f23b34cc5..6e53b8e43f 100644 --- a/agenthub/planner_agent/agent.py +++ b/agenthub/planner_agent/agent.py @@ -1,3 +1,4 @@ +from agenthub.planner_agent.prompt import get_prompt_and_images from agenthub.planner_agent.response_parser import PlannerResponseParser from openhands.controller.agent import Agent 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.llm.llm import LLM -from .prompt import get_prompt_and_images - class PlannerAgent(Agent): VERSION = '1.0' diff --git a/evaluation/mint/tasks/__init__.py b/evaluation/mint/tasks/__init__.py index 410d89c016..4f6ac721ac 100644 --- a/evaluation/mint/tasks/__init__.py +++ b/evaluation/mint/tasks/__init__.py @@ -1,6 +1,10 @@ -from .base import Task -from .codegen import HumanEvalTask, MBPPTask -from .reasoning import MultipleChoiceTask, ReasoningTask, TheoremqaTask +from evaluation.mint.tasks.base import Task +from evaluation.mint.tasks.codegen import HumanEvalTask, MBPPTask +from evaluation.mint.tasks.reasoning import ( + MultipleChoiceTask, + ReasoningTask, + TheoremqaTask, +) __all__ = [ 'Task', diff --git a/evaluation/mint/tasks/codegen.py b/evaluation/mint/tasks/codegen.py index 1b40657b42..8a80594ce4 100644 --- a/evaluation/mint/tasks/codegen.py +++ b/evaluation/mint/tasks/codegen.py @@ -2,7 +2,7 @@ import logging from utils import check_correctness -from .base import Task +from evaluation.mint.tasks.base import Task LOGGER = logging.getLogger('MINT') diff --git a/openhands/controller/__init__.py b/openhands/controller/__init__.py index 703cd40a56..c050e6e4dd 100644 --- a/openhands/controller/__init__.py +++ b/openhands/controller/__init__.py @@ -1,4 +1,4 @@ -from .agent_controller import AgentController +from openhands.controller.agent_controller import AgentController __all__ = [ 'AgentController', diff --git a/openhands/core/schema/__init__.py b/openhands/core/schema/__init__.py index 2fa4e1aa3e..370bf022f8 100644 --- a/openhands/core/schema/__init__.py +++ b/openhands/core/schema/__init__.py @@ -1,7 +1,7 @@ -from .action import ActionType -from .agent import AgentState -from .config import ConfigType -from .observation import ObservationType +from openhands.core.schema.action import ActionType +from openhands.core.schema.agent import AgentState +from openhands.core.schema.config import ConfigType +from openhands.core.schema.observation import ObservationType __all__ = [ 'ActionType', diff --git a/openhands/core/utils/__init__.py b/openhands/core/utils/__init__.py index 33012ec028..7cf6db84fd 100644 --- a/openhands/core/utils/__init__.py +++ b/openhands/core/utils/__init__.py @@ -1,3 +1,3 @@ -from .singleton import Singleton +from openhands.core.utils.singleton import Singleton __all__ = ['Singleton'] diff --git a/openhands/events/__init__.py b/openhands/events/__init__.py index f128f86233..c1694dba4b 100644 --- a/openhands/events/__init__.py +++ b/openhands/events/__init__.py @@ -1,5 +1,5 @@ -from .event import Event, EventSource -from .stream import EventStream, EventStreamSubscriber +from openhands.events.event import Event, EventSource +from openhands.events.stream import EventStream, EventStreamSubscriber __all__ = [ 'Event', diff --git a/openhands/events/action/__init__.py b/openhands/events/action/__init__.py index 3a4baacb22..386d614c18 100644 --- a/openhands/events/action/__init__.py +++ b/openhands/events/action/__init__.py @@ -1,17 +1,17 @@ -from .action import Action, ActionConfirmationStatus -from .agent import ( +from openhands.events.action.action import Action, ActionConfirmationStatus +from openhands.events.action.agent import ( AgentDelegateAction, AgentFinishAction, AgentRejectAction, AgentSummarizeAction, ChangeAgentStateAction, ) -from .browse import BrowseInteractiveAction, BrowseURLAction -from .commands import CmdRunAction, IPythonRunCellAction -from .empty import NullAction -from .files import FileReadAction, FileWriteAction -from .message import MessageAction -from .tasks import AddTaskAction, ModifyTaskAction +from openhands.events.action.browse import BrowseInteractiveAction, BrowseURLAction +from openhands.events.action.commands import CmdRunAction, IPythonRunCellAction +from openhands.events.action.empty import NullAction +from openhands.events.action.files import FileReadAction, FileWriteAction +from openhands.events.action.message import MessageAction +from openhands.events.action.tasks import AddTaskAction, ModifyTaskAction __all__ = [ 'Action', diff --git a/openhands/events/action/agent.py b/openhands/events/action/agent.py index e4b57dc5e9..f49f573ed6 100644 --- a/openhands/events/action/agent.py +++ b/openhands/events/action/agent.py @@ -2,8 +2,7 @@ from dataclasses import dataclass, field from typing import Any from openhands.core.schema import ActionType - -from .action import Action +from openhands.events.action.action import Action @dataclass diff --git a/openhands/events/action/browse.py b/openhands/events/action/browse.py index f3e949c021..441c863140 100644 --- a/openhands/events/action/browse.py +++ b/openhands/events/action/browse.py @@ -2,8 +2,7 @@ from dataclasses import dataclass from typing import ClassVar from openhands.core.schema import ActionType - -from .action import Action, ActionSecurityRisk +from openhands.events.action.action import Action, ActionSecurityRisk @dataclass diff --git a/openhands/events/action/commands.py b/openhands/events/action/commands.py index 848aae23c2..41ad0104c4 100644 --- a/openhands/events/action/commands.py +++ b/openhands/events/action/commands.py @@ -2,8 +2,11 @@ from dataclasses import dataclass from typing import ClassVar from openhands.core.schema import ActionType - -from .action import Action, ActionConfirmationStatus, ActionSecurityRisk +from openhands.events.action.action import ( + Action, + ActionConfirmationStatus, + ActionSecurityRisk, +) @dataclass diff --git a/openhands/events/action/empty.py b/openhands/events/action/empty.py index 1cb885ce05..32e0346001 100644 --- a/openhands/events/action/empty.py +++ b/openhands/events/action/empty.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ActionType - -from .action import Action +from openhands.events.action.action import Action @dataclass diff --git a/openhands/events/action/files.py b/openhands/events/action/files.py index dd1bf277cc..f323fc9181 100644 --- a/openhands/events/action/files.py +++ b/openhands/events/action/files.py @@ -2,8 +2,7 @@ from dataclasses import dataclass from typing import ClassVar from openhands.core.schema import ActionType - -from .action import Action, ActionSecurityRisk +from openhands.events.action.action import Action, ActionSecurityRisk @dataclass diff --git a/openhands/events/action/message.py b/openhands/events/action/message.py index d0586330ea..55fb21f359 100644 --- a/openhands/events/action/message.py +++ b/openhands/events/action/message.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ActionType - -from .action import Action, ActionSecurityRisk +from openhands.events.action.action import Action, ActionSecurityRisk @dataclass diff --git a/openhands/events/action/tasks.py b/openhands/events/action/tasks.py index 95df784d35..b1f1c215f7 100644 --- a/openhands/events/action/tasks.py +++ b/openhands/events/action/tasks.py @@ -1,8 +1,7 @@ from dataclasses import dataclass, field from openhands.core.schema import ActionType - -from .action import Action +from openhands.events.action.action import Action @dataclass diff --git a/openhands/events/observation/__init__.py b/openhands/events/observation/__init__.py index fb498fcc38..7fac198d31 100644 --- a/openhands/events/observation/__init__.py +++ b/openhands/events/observation/__init__.py @@ -1,13 +1,16 @@ -from .agent import AgentStateChangedObservation -from .browse import BrowserOutputObservation -from .commands import CmdOutputObservation, IPythonRunCellObservation -from .delegate import AgentDelegateObservation -from .empty import NullObservation -from .error import ErrorObservation -from .files import FileReadObservation, FileWriteObservation -from .observation import Observation -from .reject import UserRejectObservation -from .success import SuccessObservation +from openhands.events.observation.agent import AgentStateChangedObservation +from openhands.events.observation.browse import BrowserOutputObservation +from openhands.events.observation.commands import ( + CmdOutputObservation, + IPythonRunCellObservation, +) +from openhands.events.observation.delegate import AgentDelegateObservation +from openhands.events.observation.empty import NullObservation +from openhands.events.observation.error import ErrorObservation +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__ = [ 'Observation', diff --git a/openhands/events/observation/agent.py b/openhands/events/observation/agent.py index f18010e8da..802c23c378 100644 --- a/openhands/events/observation/agent.py +++ b/openhands/events/observation/agent.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/observation/browse.py b/openhands/events/observation/browse.py index f110f382a9..a337b5f260 100644 --- a/openhands/events/observation/browse.py +++ b/openhands/events/observation/browse.py @@ -1,8 +1,7 @@ from dataclasses import dataclass, field from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/observation/commands.py b/openhands/events/observation/commands.py index 1ca7d09451..7f1d409d83 100644 --- a/openhands/events/observation/commands.py +++ b/openhands/events/observation/commands.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/observation/delegate.py b/openhands/events/observation/delegate.py index d5c68278fd..9e98c6b598 100644 --- a/openhands/events/observation/delegate.py +++ b/openhands/events/observation/delegate.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/observation/empty.py b/openhands/events/observation/empty.py index 3dcfe3ead9..9d7d0f18a7 100644 --- a/openhands/events/observation/empty.py +++ b/openhands/events/observation/empty.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/observation/error.py b/openhands/events/observation/error.py index 348b898be0..d3b5f0e9df 100644 --- a/openhands/events/observation/error.py +++ b/openhands/events/observation/error.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/observation/files.py b/openhands/events/observation/files.py index a1fc178f7a..8432393ff9 100644 --- a/openhands/events/observation/files.py +++ b/openhands/events/observation/files.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/observation/reject.py b/openhands/events/observation/reject.py index 2d97f853ef..3475b19319 100644 --- a/openhands/events/observation/reject.py +++ b/openhands/events/observation/reject.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/observation/success.py b/openhands/events/observation/success.py index 269fe2345b..27ef979977 100644 --- a/openhands/events/observation/success.py +++ b/openhands/events/observation/success.py @@ -1,8 +1,7 @@ from dataclasses import dataclass from openhands.core.schema import ObservationType - -from .observation import Observation +from openhands.events.observation.observation import Observation @dataclass diff --git a/openhands/events/serialization/__init__.py b/openhands/events/serialization/__init__.py index ead1ec7369..67b9d30d08 100644 --- a/openhands/events/serialization/__init__.py +++ b/openhands/events/serialization/__init__.py @@ -1,12 +1,12 @@ -from .action import ( +from openhands.events.serialization.action import ( action_from_dict, ) -from .event import ( +from openhands.events.serialization.event import ( event_from_dict, event_to_dict, event_to_memory, ) -from .observation import ( +from openhands.events.serialization.observation import ( observation_from_dict, ) diff --git a/openhands/events/serialization/event.py b/openhands/events/serialization/event.py index 9645c90df3..e653f508d1 100644 --- a/openhands/events/serialization/event.py +++ b/openhands/events/serialization/event.py @@ -3,10 +3,9 @@ from datetime import datetime from openhands.events import Event, EventSource from openhands.events.observation.observation import Observation - -from .action import action_from_dict -from .observation import observation_from_dict -from .utils import remove_fields +from openhands.events.serialization.action import action_from_dict +from openhands.events.serialization.observation import observation_from_dict +from openhands.events.serialization.utils import remove_fields # TODO: move `content` into `extras` TOP_KEYS = ['id', 'timestamp', 'source', 'message', 'cause', 'action', 'observation'] diff --git a/openhands/events/stream.py b/openhands/events/stream.py index c04de94b03..93dad1c534 100644 --- a/openhands/events/stream.py +++ b/openhands/events/stream.py @@ -6,11 +6,10 @@ from typing import Callable, Iterable from openhands.core.logger import openhands_logger as logger 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.storage import FileStore -from .event import Event, EventSource - class EventStreamSubscriber(str, Enum): AGENT_CONTROLLER = 'agent_controller' diff --git a/openhands/memory/__init__.py b/openhands/memory/__init__.py index 9a705a24ac..0ce208cef5 100644 --- a/openhands/memory/__init__.py +++ b/openhands/memory/__init__.py @@ -1,5 +1,5 @@ -from .condenser import MemoryCondenser -from .history import ShortTermHistory -from .memory import LongTermMemory +from openhands.memory.condenser import MemoryCondenser +from openhands.memory.history import ShortTermHistory +from openhands.memory.memory import LongTermMemory __all__ = ['LongTermMemory', 'ShortTermHistory', 'MemoryCondenser'] diff --git a/openhands/runtime/__init__.py b/openhands/runtime/__init__.py index a189cb13ea..97c212cc42 100644 --- a/openhands/runtime/__init__.py +++ b/openhands/runtime/__init__.py @@ -1,14 +1,14 @@ -from .e2b.sandbox import E2BBox +from openhands.runtime.e2b.sandbox import E2BBox def get_runtime_cls(name: str): # Local imports to avoid circular imports if name == 'eventstream': - from .client.runtime import EventStreamRuntime + from openhands.runtime.client.runtime import EventStreamRuntime return EventStreamRuntime elif name == 'e2b': - from .e2b.runtime import E2BRuntime + from openhands.runtime.e2b.runtime import E2BRuntime return E2BRuntime else: diff --git a/openhands/runtime/browser/__init__.py b/openhands/runtime/browser/__init__.py index 5dcd63dbf6..2687e03c68 100644 --- a/openhands/runtime/browser/__init__.py +++ b/openhands/runtime/browser/__init__.py @@ -1,3 +1,3 @@ -from .utils import browse +from openhands.runtime.browser.utils import browse __all__ = ['browse'] diff --git a/openhands/runtime/builder/__init__.py b/openhands/runtime/builder/__init__.py index dbd0067203..fcebb8a240 100644 --- a/openhands/runtime/builder/__init__.py +++ b/openhands/runtime/builder/__init__.py @@ -1,4 +1,4 @@ -from .base import RuntimeBuilder -from .docker import DockerRuntimeBuilder +from openhands.runtime.builder.base import RuntimeBuilder +from openhands.runtime.builder.docker import DockerRuntimeBuilder __all__ = ['RuntimeBuilder', 'DockerRuntimeBuilder'] diff --git a/openhands/runtime/builder/docker.py b/openhands/runtime/builder/docker.py index 952df244d8..750ea8423e 100644 --- a/openhands/runtime/builder/docker.py +++ b/openhands/runtime/builder/docker.py @@ -1,8 +1,7 @@ import docker from openhands.core.logger import openhands_logger as logger - -from .base import RuntimeBuilder +from openhands.runtime.builder.base import RuntimeBuilder class DockerRuntimeBuilder(RuntimeBuilder): diff --git a/openhands/runtime/e2b/runtime.py b/openhands/runtime/e2b/runtime.py index 8694c94636..852e419f68 100644 --- a/openhands/runtime/e2b/runtime.py +++ b/openhands/runtime/e2b/runtime.py @@ -10,12 +10,11 @@ from openhands.events.observation import ( Observation, ) 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.runtime import Runtime - -from ..utils.files import insert_lines, read_lines -from .filestore import E2BFileStore -from .sandbox import E2BSandbox +from openhands.runtime.utils.files import insert_lines, read_lines class E2BRuntime(Runtime): diff --git a/openhands/runtime/plugins/__init__.py b/openhands/runtime/plugins/__init__.py index fac44a3625..66bc499a11 100644 --- a/openhands/runtime/plugins/__init__.py +++ b/openhands/runtime/plugins/__init__.py @@ -1,7 +1,10 @@ # Requirements -from .agent_skills import AgentSkillsPlugin, AgentSkillsRequirement -from .jupyter import JupyterPlugin, JupyterRequirement -from .requirement import Plugin, PluginRequirement +from openhands.runtime.plugins.agent_skills import ( + AgentSkillsPlugin, + AgentSkillsRequirement, +) +from openhands.runtime.plugins.jupyter import JupyterPlugin, JupyterRequirement +from openhands.runtime.plugins.requirement import Plugin, PluginRequirement __all__ = [ 'Plugin', diff --git a/openhands/runtime/plugins/agent_skills/__init__.py b/openhands/runtime/plugins/agent_skills/__init__.py index 69dd1e9621..01f9d7e028 100644 --- a/openhands/runtime/plugins/agent_skills/__init__.py +++ b/openhands/runtime/plugins/agent_skills/__init__.py @@ -1,9 +1,8 @@ from dataclasses import dataclass +from openhands.runtime.plugins.agent_skills import agentskills from openhands.runtime.plugins.requirement import Plugin, PluginRequirement -from . import agentskills - @dataclass class AgentSkillsRequirement(PluginRequirement): diff --git a/openhands/runtime/plugins/agent_skills/agentskills.py b/openhands/runtime/plugins/agent_skills/agentskills.py index 8984f8d135..dd34e3878d 100644 --- a/openhands/runtime/plugins/agent_skills/agentskills.py +++ b/openhands/runtime/plugins/agent_skills/agentskills.py @@ -1,7 +1,7 @@ from inspect import signature -from . import file_ops, file_reader -from .utils.dependency import import_functions +from openhands.runtime.plugins.agent_skills import file_ops, file_reader +from openhands.runtime.plugins.agent_skills.utils.dependency import import_functions import_functions( module=file_ops, function_names=file_ops.__all__, target_globals=globals() diff --git a/openhands/runtime/plugins/agent_skills/file_ops/__init__.py b/openhands/runtime/plugins/agent_skills/file_ops/__init__.py index daf2449f8c..26b38437a4 100644 --- a/openhands/runtime/plugins/agent_skills/file_ops/__init__.py +++ b/openhands/runtime/plugins/agent_skills/file_ops/__init__.py @@ -1,5 +1,5 @@ -from ..utils.dependency import import_functions -from . import file_ops +from openhands.runtime.plugins.agent_skills.file_ops import file_ops +from openhands.runtime.plugins.agent_skills.utils.dependency import import_functions import_functions( module=file_ops, function_names=file_ops.__all__, target_globals=globals() diff --git a/openhands/runtime/plugins/agent_skills/file_ops/file_ops.py b/openhands/runtime/plugins/agent_skills/file_ops/file_ops.py index 9e7a2188ab..f48e9bb872 100644 --- a/openhands/runtime/plugins/agent_skills/file_ops/file_ops.py +++ b/openhands/runtime/plugins/agent_skills/file_ops/file_ops.py @@ -24,7 +24,7 @@ import tempfile if __package__ is None or __package__ == '': from aider import Linter else: - from ..utils.aider import Linter + from openhands.runtime.plugins.agent_skills.utils.aider import Linter CURRENT_FILE: str | None = None CURRENT_LINE = 1 diff --git a/openhands/runtime/plugins/agent_skills/file_reader/__init__.py b/openhands/runtime/plugins/agent_skills/file_reader/__init__.py index b50d6fb19c..70d080a94d 100644 --- a/openhands/runtime/plugins/agent_skills/file_reader/__init__.py +++ b/openhands/runtime/plugins/agent_skills/file_reader/__init__.py @@ -1,5 +1,5 @@ -from ..utils.dependency import import_functions -from . import file_readers +from openhands.runtime.plugins.agent_skills.file_reader import file_readers +from openhands.runtime.plugins.agent_skills.utils.dependency import import_functions import_functions( module=file_readers, function_names=file_readers.__all__, target_globals=globals() diff --git a/openhands/runtime/plugins/agent_skills/file_reader/file_readers.py b/openhands/runtime/plugins/agent_skills/file_reader/file_readers.py index ab088ca1e6..ee41eab0e4 100644 --- a/openhands/runtime/plugins/agent_skills/file_reader/file_readers.py +++ b/openhands/runtime/plugins/agent_skills/file_reader/file_readers.py @@ -25,7 +25,7 @@ import PyPDF2 from pptx import Presentation from pylatexenc.latex2text import LatexNodes2Text -from ..utils.config import ( +from openhands.runtime.plugins.agent_skills.utils.config import ( _get_max_token, _get_openai_api_key, _get_openai_base_url, diff --git a/openhands/runtime/plugins/agent_skills/utils/aider/__init__.py b/openhands/runtime/plugins/agent_skills/utils/aider/__init__.py index d8a58af44d..15a4cb3172 100644 --- a/openhands/runtime/plugins/agent_skills/utils/aider/__init__.py +++ b/openhands/runtime/plugins/agent_skills/utils/aider/__init__.py @@ -1,6 +1,9 @@ if __package__ is None or __package__ == '': from linter import Linter, LintResult else: - from .linter import Linter, LintResult + from openhands.runtime.plugins.agent_skills.utils.aider.linter import ( + Linter, + LintResult, + ) __all__ = ['Linter', 'LintResult'] diff --git a/openhands/runtime/plugins/jupyter/__init__.py b/openhands/runtime/plugins/jupyter/__init__.py index 7245e25482..f816bdb305 100644 --- a/openhands/runtime/plugins/jupyter/__init__.py +++ b/openhands/runtime/plugins/jupyter/__init__.py @@ -5,11 +5,10 @@ from dataclasses import dataclass from openhands.core.logger import openhands_logger as logger from openhands.events.action import Action, IPythonRunCellAction 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.utils import find_available_tcp_port -from .execute_server import JupyterKernel - @dataclass class JupyterRequirement(PluginRequirement): diff --git a/openhands/runtime/utils/__init__.py b/openhands/runtime/utils/__init__.py index e1512a7e87..eca9436da6 100644 --- a/openhands/runtime/utils/__init__.py +++ b/openhands/runtime/utils/__init__.py @@ -1,4 +1,4 @@ -from .bash import split_bash_commands -from .system import find_available_tcp_port +from openhands.runtime.utils.bash import split_bash_commands +from openhands.runtime.utils.system import find_available_tcp_port __all__ = ['find_available_tcp_port', 'split_bash_commands'] diff --git a/openhands/security/__init__.py b/openhands/security/__init__.py index 4d1ef4490c..0eaa19563d 100644 --- a/openhands/security/__init__.py +++ b/openhands/security/__init__.py @@ -1,5 +1,5 @@ -from .analyzer import SecurityAnalyzer -from .invariant.analyzer import InvariantAnalyzer +from openhands.security.analyzer import SecurityAnalyzer +from openhands.security.invariant.analyzer import InvariantAnalyzer __all__ = [ 'SecurityAnalyzer', diff --git a/openhands/security/invariant/__init__.py b/openhands/security/invariant/__init__.py index e2ad7f7698..9445ef804a 100644 --- a/openhands/security/invariant/__init__.py +++ b/openhands/security/invariant/__init__.py @@ -1,4 +1,4 @@ -from .analyzer import InvariantAnalyzer +from openhands.security.invariant.analyzer import InvariantAnalyzer __all__ = [ 'InvariantAnalyzer', diff --git a/openhands/server/auth/__init__.py b/openhands/server/auth/__init__.py index 20e969354e..0fe3ddd8cc 100644 --- a/openhands/server/auth/__init__.py +++ b/openhands/server/auth/__init__.py @@ -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'] diff --git a/openhands/server/session/__init__.py b/openhands/server/session/__init__.py index 383864a4b7..3ee03d9594 100644 --- a/openhands/server/session/__init__.py +++ b/openhands/server/session/__init__.py @@ -1,4 +1,4 @@ -from .manager import SessionManager -from .session import Session +from openhands.server.session.manager import SessionManager +from openhands.server.session.session import Session __all__ = ['Session', 'SessionManager'] diff --git a/openhands/server/session/manager.py b/openhands/server/session/manager.py index e795daf221..074ca9b6e7 100644 --- a/openhands/server/session/manager.py +++ b/openhands/server/session/manager.py @@ -5,10 +5,9 @@ from fastapi import WebSocket from openhands.core.config import AppConfig from openhands.core.logger import openhands_logger as logger +from openhands.server.session.session import Session from openhands.storage.files import FileStore -from .session import Session - class SessionManager: _sessions: dict[str, Session] = {} diff --git a/openhands/server/session/session.py b/openhands/server/session/session.py index 10415b4440..fd6a19c4ea 100644 --- a/openhands/server/session/session.py +++ b/openhands/server/session/session.py @@ -20,10 +20,9 @@ from openhands.events.observation import ( from openhands.events.serialization import event_from_dict, event_to_dict from openhands.events.stream import EventStreamSubscriber from openhands.llm.llm import LLM +from openhands.server.session.agent import AgentSession from openhands.storage.files import FileStore -from .agent import AgentSession - DEL_DELT_SEC = 60 * 60 * 5 diff --git a/openhands/storage/__init__.py b/openhands/storage/__init__.py index c863d3ddc2..57c164c29d 100644 --- a/openhands/storage/__init__.py +++ b/openhands/storage/__init__.py @@ -1,7 +1,7 @@ -from .files import FileStore -from .local import LocalFileStore -from .memory import InMemoryFileStore -from .s3 import S3FileStore +from openhands.storage.files import FileStore +from openhands.storage.local import LocalFileStore +from openhands.storage.memory import InMemoryFileStore +from openhands.storage.s3 import S3FileStore def get_file_store(file_store: str, file_store_path: str | None = None) -> FileStore: diff --git a/openhands/storage/local.py b/openhands/storage/local.py index 6e30cdc4ea..38815bce1f 100644 --- a/openhands/storage/local.py +++ b/openhands/storage/local.py @@ -2,8 +2,7 @@ import os import shutil from openhands.core.logger import openhands_logger as logger - -from .files import FileStore +from openhands.storage.files import FileStore class LocalFileStore(FileStore): diff --git a/openhands/storage/memory.py b/openhands/storage/memory.py index 1cb40b9099..4792b88f41 100644 --- a/openhands/storage/memory.py +++ b/openhands/storage/memory.py @@ -1,8 +1,7 @@ import os from openhands.core.logger import openhands_logger as logger - -from .files import FileStore +from openhands.storage.files import FileStore class InMemoryFileStore(FileStore): diff --git a/openhands/storage/s3.py b/openhands/storage/s3.py index 4f6d3c4f5f..368b6f4ffb 100644 --- a/openhands/storage/s3.py +++ b/openhands/storage/s3.py @@ -2,7 +2,7 @@ import os from minio import Minio -from .files import FileStore +from openhands.storage.files import FileStore AWS_S3_ENDPOINT = 's3.amazonaws.com'