Merge branch 'main' into add_news_display

Conflicts:
	src/serena/tools/jetbrains_tools.py
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-01-13 12:36:07 +01:00
commit 341ac2ed59
3 files changed
+19 -10

No files matched your search

+3 -3
View File
@@ -593,12 +593,12 @@ class SerenaDashboardAPI:
self._agent.remove_language(language)
@staticmethod
def _find_first_free_port(start_port: int) -> int:
def _find_first_free_port(start_port: int, host: str) -> int:
port = start_port
while port <= 65535:
try:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.bind(("0.0.0.0", port))
sock.bind((host, port))
return port
except OSError:
port += 1
@@ -618,7 +618,7 @@ class SerenaDashboardAPI:
return port
def run_in_thread(self, host: str) -> tuple[threading.Thread, int]:
port = self._find_first_free_port(0x5EDA)
port = self._find_first_free_port(0x5EDA, host)
log.info("Starting dashboard (listen_address=%s, port=%d)", host, port)
thread = threading.Thread(target=lambda: self.run(host=host, port=port), daemon=True)
thread.start()
+11 -6
View File
@@ -118,6 +118,8 @@ class JetBrainsGetSymbolsOverviewTool(Tool, ToolMarkerSymbolicRead, ToolMarkerOp
Retrieves an overview of the top-level symbols within a specified file using the JetBrains backend
"""
USE_COMPACT_FORMAT = True
@staticmethod
def _transform_symbols_to_compact_format(symbols: list[jb.SymbolDTO]) -> dict[str, list]:
"""
@@ -174,12 +176,15 @@ class JetBrainsGetSymbolsOverviewTool(Tool, ToolMarkerSymbolicRead, ToolMarkerOp
symbol_overview = client.get_symbols_overview(
relative_path=relative_path, depth=depth, include_file_documentation=include_file_documentation
)
symbols = symbol_overview["symbols"]
result: dict[str, Any] = {"symbols": self._transform_symbols_to_compact_format(symbols)}
documentation = symbol_overview.pop("documentation", None)
if documentation:
result["docstring"] = documentation
json_result = self._to_json(result)
if self.USE_COMPACT_FORMAT:
symbols = symbol_overview["symbols"]
result: dict[str, Any] = {"symbols": self._transform_symbols_to_compact_format(symbols)}
documentation = symbol_overview.pop("documentation", None)
if documentation:
result["docstring"] = documentation
json_result = self._to_json(result)
else:
json_result = self._to_json(symbol_overview)
return self._limit_length(json_result, max_answer_chars)
+5 -1
View File
@@ -52,7 +52,11 @@ def scan_directory(
entry_path = entry.path
if rel_base:
result_path = os.path.relpath(entry_path, rel_base)
try:
result_path = os.path.relpath(entry_path, rel_base)
except:
log.debug(f"Skipping entry due to relative path conversion error: {entry.path}")
continue
else:
result_path = entry_path