Drop ReferencedType declarations that discovery renders redundant

Only the three declarations carrying member curation remain (LanguageServerSymbol, ReplacementOccurrence, MatchedConsecutiveLines); the discovered type sets are unchanged.
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-09-15 12:50:44 +02:00
1 parent 44a283ee99
commit e6f0d7839c
7 files changed
+10 -23

No files matched your search

-1
View File
@@ -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"],
-3
View File
@@ -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"]
),
+1 -6
View File
@@ -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
-5
View File
@@ -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),
],
)
+1 -2
View File
@@ -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:
+2 -2
View File
@@ -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(
+6 -4
View File
@@ -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