serena.dashboard

Contents

serena.dashboard#


class RequestLog(*, start_idx=0)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

start_idx (int)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ResponseLog(*, messages, max_idx, active_project=None)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • messages (list[str])

  • max_idx (int)

  • active_project (str | None)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ResponseToolNames(*, tool_names)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

tool_names (list[str])

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ResponseToolStats(*, stats)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

stats (dict[str, dict[str, int]])

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ResponseConfigOverview(
*,
active_project,
context,
modes,
active_tools,
tool_stats_summary,
registered_projects,
available_tools,
available_modes,
available_contexts,
available_memories,
jetbrains_mode,
languages,
encoding,
current_client,
serena_version,
newer_serena_version,
)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • active_project (dict[str, str | None])

  • context (dict[str, str])

  • modes (list[dict[str, str]])

  • active_tools (list[str])

  • tool_stats_summary (dict[str, dict[str, int]])

  • registered_projects (list[dict[str, str | bool]])

  • available_tools (list[dict[str, str | bool]])

  • available_modes (list[dict[str, str | bool]])

  • available_contexts (list[dict[str, str | bool]])

  • available_memories (list[str] | None)

  • jetbrains_mode (bool)

  • languages (list[str])

  • encoding (str | None)

  • current_client (str | None)

  • serena_version (str)

  • newer_serena_version (str | None)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ResponseAvailableLanguages(*, languages)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

languages (list[str])

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RequestAddLanguage(*, language)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

language (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RequestRemoveLanguage(*, language)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

language (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RequestGetMemory(*, memory_name)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

memory_name (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ResponseGetMemory(*, content, memory_name)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • content (str)

  • memory_name (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RequestSaveMemory(*, memory_name, content)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • memory_name (str)

  • content (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RequestDeleteMemory(*, memory_name)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

memory_name (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RequestRenameMemory(*, old_name, new_name)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • old_name (str)

  • new_name (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ResponseGetSerenaConfig(*, content)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

content (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RequestSaveSerenaConfig(*, content)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

content (str)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RequestCancelTaskExecution(*, task_id)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

task_id (int)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class QueuedExecution(*, task_id, is_running, name, finished_successfully, logged)[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • task_id (int)

  • is_running (bool)

  • name (str)

  • finished_successfully (bool)

  • logged (bool)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

open_url_in_browser(url, use_subprocess=False)[source]#

Opens the given URL in the user’s default web browser, optionally using a subprocess to ensure that no output is written to stdout (highly problematic when run within a stdio MCP server context)

Parameters:
  • url (str) – the URL to open

  • use_subprocess (bool) – whether to use a subprocess to opening the URL, making stdio contamination impossible

Return type:

None

class SerenaDashboardViewer(
url,
*,
width=1400,
height=900,
start_minimized=False,
parent_process_id=None,
tray=True,
)[source]#

Bases: WebViewWithTray

Minimal pywebview wrapper that opens a dashboard in a native window with optional system tray.

Parameters:
  • url (str) – the URL to open

  • width (int) – the width of the window

  • height (int) – the height of the window

  • start_minimized (bool) – whether to start the window minimized (to the tray if tray is enabled)

  • parent_process_id (int | None) – the process ID of the parent Serena agent process, which is monitored for termination, automatically closing the dashboard when the parent process dies

  • tray (bool) – whether to use a system tray icon (which the app minimizes to when the window is closed)

static is_current_platform_supported()[source]#
Returns:

whether the current platform supports the native dashboard viewer (and tray manager).

Return type:

bool

class TrayManagedInstance(port, parent_process, dashboard_url, project, started_at)[source]#

Bases: object

A registered Serena dashboard instance managed by the tray manager.

Parameters:
  • port (int)

  • parent_process (Process)

  • dashboard_url (str)

  • project (str | None)

  • started_at (str)

port: int#

the port on which the dashboard API is listening

parent_process: Process#

the process of the Serena agent owning this dashboard instance

dashboard_url: str#

the full URL to the dashboard frontend

project: str | None#

the name of the active project, or None if no project is activated

started_at: str#

ISO 8601 timestamp of when the agent instance was started

class SerenaDashboardTrayManager(use_pywebview=False, alive_check_use_pid=True)[source]#

Bases: object

Singleton process managing a system tray icon for all Serena dashboard instances.

Runs a Flask backend on a fixed port and displays a single tray icon that aggregates all running Serena instances. Individual dashboard viewers are spawned on demand when the user clicks a menu item.

The manager is started as a detached process by the first Serena agent that needs it and terminates automatically when no dashboard instances remain.

Parameters:
  • use_pywebview (bool) – whether to use pywebview-based viewer applications (separate child processes) for opening dashboards; if False, open them directly in the user’s default web browser.

  • alive_check_use_pid (bool) – whether to use the process ID for alive checks of registered instances. If True, the manager will check whether the process with the registered PID is still running. If False, the manager will perform an HTTP request to the instance’s heartbeat endpoint to check if it’s alive.

HOST = '127.0.0.1'#

listen address (local only)

ALIVE_CHECK_INTERVAL_SECONDS = 3#

interval in seconds between alive checks of registered instances

run()[source]#

Run the tray manager (blocking). Starts Flask, alive-check thread, and tray icon.

Return type:

None

classmethod is_current_platform_supported()[source]#
Returns:

whether the current platform supports the tray manager

Return type:

bool

classmethod is_running()[source]#
Returns:

True if a tray manager process is already listening on the fixed port

Return type:

bool

classmethod ensure_running()[source]#

Ensure a tray manager process is running, starting one if necessary.

Return type:

None

classmethod register_instance(
port,
dashboard_url,
project,
started_at,
open_viewer=False,
)[source]#

Register a dashboard instance with the running tray manager.

Parameters:
  • port (int) – the port of the dashboard API (used for alive checks)

  • dashboard_url (str) – the full URL to the dashboard frontend

  • project (str | None) – the currently active project name, or None

  • started_at (str) – ISO 8601 timestamp of when the agent was started

  • open_viewer (bool) – whether the tray manager should immediately open a viewer for this instance

Return type:

None

classmethod update_project(port, project)[source]#

Notify the tray manager of a project change for the given instance.

Parameters:
  • port (int) – the port of the dashboard API

  • project (str | None) – the new active project name, or None

Return type:

None

classmethod unregister_instance(port)[source]#

Unregister a dashboard instance from the tray manager.

Parameters:

port (int) – the port of the dashboard API to unregister

Return type:

None