From 5edf905833f8b3da2553cdb43831d22ea52ded12 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Wed, 2 Jul 2025 11:13:35 +0200 Subject: [PATCH] Add config item web_dashboard_open_on_launch --- CHANGELOG.md | 2 ++ src/serena/agent.py | 5 ++++- src/serena/resources/serena_config.template.yml | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7644734..ca4378f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ Status of the `main` branch. Changes prior to the next official version change w * Language support: * Better support for C# by switching from `omnisharp` to Microsoft's official C# language server. * **Add support for Clojure** +* Configuration: + * Add option `web_dashboard_open_on_launch` (allowing the dashboard to be enabled without opening a browser window) Fixes: * Fix `ExecuteShellCommandTool` and `GetCurrentConfigTool` hanging on Windows diff --git a/src/serena/agent.py b/src/serena/agent.py index 8f68119..09aa297 100644 --- a/src/serena/agent.py +++ b/src/serena/agent.py @@ -275,6 +275,7 @@ class SerenaConfigBase(ABC): log_level: int = logging.INFO trace_lsp_communication: bool = False web_dashboard: bool = True + web_dashboard_open_on_launch: bool = True tool_timeout: float = DEFAULT_TOOL_TIMEOUT @cached_property @@ -446,6 +447,7 @@ class SerenaConfig(SerenaConfigBase): instance.gui_log_window_enabled = loaded_commented_yaml.get("gui_log_window", False) instance.log_level = loaded_commented_yaml.get("log_level", loaded_commented_yaml.get("gui_log_level", logging.INFO)) instance.web_dashboard = loaded_commented_yaml.get("web_dashboard", True) + instance.web_dashboard_open_on_launch = loaded_commented_yaml.get("web_dashboard_open_on_launch", True) instance.tool_timeout = loaded_commented_yaml.get("tool_timeout", DEFAULT_TOOL_TIMEOUT) instance.trace_lsp_communication = loaded_commented_yaml.get("trace_lsp_communication", False) @@ -792,7 +794,8 @@ class SerenaAgent: dashboard_log_handler = MemoryLogHandler(level=serena_log_level) Logger.root.addHandler(dashboard_log_handler) self._dashboard_thread, port = SerenaDashboardAPI(dashboard_log_handler, tool_names).run_in_thread() - webbrowser.open(f"http://localhost:{port}/dashboard/index.html") + if self.serena_config.web_dashboard_open_on_launch: + webbrowser.open(f"http://localhost:{port}/dashboard/index.html") log.info(f"Starting Serena server (version={serena_version()}, process id={os.getpid()}, parent process id={os.getppid()})") log.info("Available projects: {}".format(", ".join(self.serena_config.project_names))) diff --git a/src/serena/resources/serena_config.template.yml b/src/serena/resources/serena_config.template.yml index e650987..0013f65 100644 --- a/src/serena/resources/serena_config.template.yml +++ b/src/serena/resources/serena_config.template.yml @@ -20,6 +20,12 @@ web_dashboard: True # shows Serena's current session logs - as an alternative to the GUI log window which # is supported on all platforms. +web_dashboard_open_on_launch: True +# whether to open a browser window with the web dashboard when Serena starts (provided that web_dashboard +# is enabled). If set to False, you can still open the dashboard manually by navigating to +# http://localhost:24282/dashboard/ in your web browser. +# If you have multiple instances running, a higher port will be used; try port 24283, 24284, etc. + log_level: 20 # the minimum log level for the GUI log window and the dashboard (10 = debug, 20 = info, 30 = warning, 40 = error)