mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
53 lines
2.0 KiB
Python
53 lines
2.0 KiB
Python
# IMPORTANT: LEGACY V0 CODE - Deprecated since version 1.0.0, scheduled for removal April 1, 2026
|
|
# This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1.
|
|
# OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application server. Please refer to:
|
|
# - V1 agentic core (SDK): https://github.com/OpenHands/software-agent-sdk
|
|
# - V1 application server (in this repo): openhands/app_server/
|
|
# Unless you are working on deprecation, please avoid extending this legacy file and consult the V1 codepaths above.
|
|
# Tag: Legacy-V0
|
|
from inspect import signature
|
|
|
|
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()
|
|
)
|
|
import_functions(
|
|
module=file_reader, function_names=file_reader.__all__, target_globals=globals()
|
|
)
|
|
|
|
__all__ = file_ops.__all__ + file_reader.__all__
|
|
|
|
try:
|
|
from openhands.runtime.plugins.agent_skills import repo_ops
|
|
|
|
import_functions(
|
|
module=repo_ops, function_names=repo_ops.__all__, target_globals=globals()
|
|
)
|
|
|
|
__all__ += repo_ops.__all__
|
|
except ImportError:
|
|
# If repo_ops is not available, we just skip importing it.
|
|
pass
|
|
|
|
|
|
DOCUMENTATION = ''
|
|
for func_name in __all__:
|
|
func = globals()[func_name]
|
|
|
|
cur_doc = func.__doc__
|
|
# remove indentation from docstring and extra empty lines
|
|
cur_doc = '\n'.join(filter(None, map(lambda x: x.strip(), cur_doc.split('\n'))))
|
|
# now add a consistent 4 indentation
|
|
cur_doc = '\n'.join(map(lambda x: ' ' * 4 + x, cur_doc.split('\n')))
|
|
|
|
fn_signature = f'{func.__name__}' + str(signature(func))
|
|
DOCUMENTATION += f'{fn_signature}:\n{cur_doc}\n\n'
|
|
|
|
|
|
# Add file_editor (a function)
|
|
from openhands.runtime.plugins.agent_skills.file_editor import file_editor # noqa: E402
|
|
|
|
__all__ += ['file_editor']
|