diff --git a/src/serena/repl/api/edit_api.py b/src/serena/repl/api/edit_api.py index adac2218..aa150e92 100644 --- a/src/serena/repl/api/edit_api.py +++ b/src/serena/repl/api/edit_api.py @@ -75,7 +75,6 @@ class EditApi(FacadeApi): name="edit", description="modifying content within existing files (independent of the language backend)", types=[ - ReferencedType(ReplacementPreview), ReferencedType( ReplacementOccurrence, members=["occurrence_id", "relative_path", "start_line", "end_line", "matched_text", "replacement", "is_ambiguous"], diff --git a/src/serena/repl/api/fs_api.py b/src/serena/repl/api/fs_api.py index 608c7c9a..09e0a54d 100644 --- a/src/serena/repl/api/fs_api.py +++ b/src/serena/repl/api/fs_api.py @@ -173,9 +173,6 @@ class FsApi(FacadeApi): name="fs", description="the project's files as units (as opposed to their content, see `edit`)", types=[ - ReferencedType(FileContent), - ReferencedType(DirectoryListing), - ReferencedType(PatternMatches), ReferencedType( MatchedConsecutiveLines, members=["source_file_path", "matched_lines", "start_line", "end_line", "to_display_string"] ), diff --git a/src/serena/repl/api/jb_api.py b/src/serena/repl/api/jb_api.py index 84e8cb35..9c8e196c 100644 --- a/src/serena/repl/api/jb_api.py +++ b/src/serena/repl/api/jb_api.py @@ -30,7 +30,7 @@ from serena.tools import ( ) from serena.util.text_utils import find_text_coordinates -from ..facade import FacadeApi, ReferencedType, facade_method +from ..facade import FacadeApi, facade_method from ..representable import JsonObject, JsonObjectRenderer, Renderer, RepresentableViaRenderer if TYPE_CHECKING: @@ -185,11 +185,6 @@ class JetBrainsApi(FacadeApi): agent, name="jb", description="operations on the codebase backed by the JetBrains IDE's code intelligence", - types=[ - ReferencedType(JetBrainsSymbolCollection), - ReferencedType(JetBrainsSymbolsOverview), - ReferencedType(JsonObject), - ], ) @contextmanager diff --git a/src/serena/repl/api/lsp_api.py b/src/serena/repl/api/lsp_api.py index fed32cee..0459f408 100644 --- a/src/serena/repl/api/lsp_api.py +++ b/src/serena/repl/api/lsp_api.py @@ -310,7 +310,6 @@ class LspApi(FacadeApi): name="lsp", description="symbol-level operations on the codebase backed by language servers", types=[ - ReferencedType(LspSymbolCollection), ReferencedType( LanguageServerSymbol, members=[ @@ -327,10 +326,6 @@ class LspApi(FacadeApi): "get_parent", ], ), - ReferencedType(LspSymbol), - ReferencedType(LspReferenceCollection), - ReferencedType(ReferenceInLanguageServerSymbol), - ReferencedType(LspDiagnostics), ], ) diff --git a/src/serena/repl/api/mem_api.py b/src/serena/repl/api/mem_api.py index 36bb2fdc..d6e41f76 100644 --- a/src/serena/repl/api/mem_api.py +++ b/src/serena/repl/api/mem_api.py @@ -18,7 +18,7 @@ from serena.tools import ( WriteMemoryTool, ) -from ..facade import FacadeApi, ReferencedType, facade_method +from ..facade import FacadeApi, facade_method from ..representable import Renderer, RepresentableViaRenderer if TYPE_CHECKING: @@ -60,7 +60,6 @@ class MemoryApi(FacadeApi): agent, name="mem", description="project memories, i.e. persistent notes for future tasks", - types=[ReferencedType(MemoryList)], ) def _get_memory_manager(self) -> MemoryManager: diff --git a/src/serena/repl/api/shell_api.py b/src/serena/repl/api/shell_api.py index 801b8e93..56ba2679 100644 --- a/src/serena/repl/api/shell_api.py +++ b/src/serena/repl/api/shell_api.py @@ -9,7 +9,7 @@ from typing import TYPE_CHECKING from serena.tools import ExecuteShellCommandTool from serena.util.shell import ShellCommandResult, execute_shell_command -from ..facade import FacadeApi, ReferencedType, facade_method +from ..facade import FacadeApi, facade_method from ..representable import Renderer, RepresentableViaRenderer if TYPE_CHECKING: @@ -53,7 +53,7 @@ class ShellCommandOutputRenderer(Renderer[ShellCommandOutput]): class ShellApi(FacadeApi): def __init__(self, agent: "SerenaAgent") -> None: - super().__init__(agent, name="shell", description="execution of shell commands", types=[ReferencedType(ShellCommandOutput)]) + super().__init__(agent, name="shell", description="execution of shell commands") @facade_method(can_edit=True, corresponding_tool=ExecuteShellCommandTool) def execute_shell_command( diff --git a/src/serena/repl/facade.py b/src/serena/repl/facade.py index 05417110..18ed06eb 100644 --- a/src/serena/repl/facade.py +++ b/src/serena/repl/facade.py @@ -89,8 +89,10 @@ def get_annotated_classes(callable_: Callable[..., Any]) -> list[type]: @dataclass class ReferencedType: """ - A type that is referenced by a facade's methods (returned by them or contained in their results), whose interface - the LLM can inspect via `info`. + A type that is referenced by a facade's methods (returned by them, contained in their results or used as a parameter + type), whose interface the LLM can inspect via `info`. + All types reachable through annotations are discovered automatically; an explicit declaration is needed only in order + to curate the type's presentation (the members to describe, inclusion in the facade's description). """ cls: type @@ -318,8 +320,8 @@ class FacadeApi(ABC): :param agent: the agent providing access to the project and its resources :param name: the attribute name under which the facade is accessible from the REPL entrypoint :param description: a one-line description of the functionality offered by the facade - :param types: the types referenced by the facade's methods (returned or contained in results) whose interface - the LLM shall be able to inspect + :param types: declarations for referenced types whose presentation is to be curated (see `ReferencedType`); + types reachable through annotations need not be declared in order to be documentable """ self._agent = agent self._name = name