100 Commits
Author SHA1 Message Date
Dominik Jain 8a3ce35cae SerenaReplTool: Make clear that print and other output functions cannot be used [skip ci] 2026-09-29 12:49:50 +02:00
Dr. Dominik Jain f581cf642d Merge pull request #2042 from davalillo/perf/search-text-line-lookup-pr
perf(search_text): precompute line offsets for O(log n) line lookup
2026-09-23 14:55:10 +02:00
Dominik Jain fba55b6844 Merge remote-tracking branch 'origin/main' into perf/search-text-line-lookup-pr
Conflicts:
  src/serena/util/text_utils.py
2026-09-23 14:07:36 +02:00
Dominik Jain 26939c447f Refactoring: Improve class naming and consolidate text coordinate representations
* Rename TextCoordinates -> TextCoordinateProvider
* Consolidate ls_util.LineCol, text_utils.TextCoords -> ls_util.TextCoordinates
2026-09-23 14:03:42 +02:00
Dominik Jain 91440326d7 Improve instructions on comments 2026-09-21 13:43:23 +02:00
Dominik Jain a3322719f1 Add explicit docs page on privacy policy 2026-09-21 13:43:23 +02:00
Dominik Jain c4dc91a7da Upgrade to MCP SDK v2.2.0
Resolves #1776
2026-09-19 12:02:08 +02:00
Dr. Dominik Jain c6fbd1c593 Merge pull request #2073 from oraios/change-session-handling
Make session IDs explicit tool parameters instead of auto-injecting them
2026-09-18 17:26:45 +02:00
Dominik Jain 7a16b3db5a Make session IDs explicit tool parameters instead of auto-injecting them
Previously, Tool.apply_ex derived a session ID from the MCP session object (or
"global" with no context) and injected it into any apply() method that declared
a session_id parameter. This is being changed because:
* the new MCP SDK v2 no longer provides session identifiers
* handling it internally is more robust anyway, since clients did not
  consistently use sessions

Session handling
- Remove implicit session ID injection from Tool.apply_ex, along with the
  supporting _is_session_aware property and SESSION_ID_PARAM_NAME skip logic
- SerenaAgent.create_system_prompt() now creates the session itself and reports
  its id, instead of receiving session_id as an argument

Tool signatures
- InitialInstructionsTool.apply() and ActivateProjectTool.apply() now declare
  session_id explicitly and rely on the LLM to pass it, rather than having it
  injected
- Rename SerenaReplTool.apply()'s session parameter to session_id for consistency
  with the other tools

Resolves #2061
2026-09-18 16:33:31 +02:00
Dr. Dominik Jain bd2712fd30 Merge pull request #2057 from oraios/backend-registry
Add language backend registry
2026-09-18 16:13:01 +02:00
Dominik Jain 3b898b671c Reify language backends, introducing LanguageBackendRegistry
* Many case differentiations in the agent code were replaced by
  method calls in the newly introduced LanguageBackend abstraction
* The registry allows new backends to be added dynamically
  (via Python packages that implement a specific entrypoint)
2026-09-18 15:20:10 +02:00
Dominik Jain 3ad4044c69 Enable ty rule 'unresolved-attribute' for test/ 2026-09-18 13:08:36 +02:00
Dominik Jain 2a6deef838 Improve description of find_declaration method to avoid confusion with find_symbol 2026-09-17 21:43:07 +02:00
Dr. Dominik Jain 84c673bae4 Merge pull request #2035 from oraios/dev-v2
Add REPL (milestone for Serena v2)
2026-09-17 21:32:08 +02:00
Dominik Jain b79e2a55f9 Add changelog entry for the Serena REPL 2026-09-17 21:16:30 +02:00
Dominik Jain 6507092288 Mark R cross-file tests as flaky #1040 2026-09-17 21:07:47 +02:00
Dominik Jain 006487cbb6 Mark REPL as a beta feature 2026-09-17 20:46:02 +02:00
Dominik Jain 205da357d5 Add note on PRs for beta features 2026-09-17 20:38:58 +02:00
Dominik Jain 42e51bd92c ty: Ignore macOS-specific imports 2026-09-17 19:16:18 +02:00
Dominik Jain 734cfa958e Authenticate project server communication with the shared secret
- Require a valid Bearer token on heartbeat and project-query requests.
- Send the configured auth_secret from clients and the query-project tool.
- Test accepted and rejected credentials, including real HTTP client requests.
2026-09-17 16:13:11 +02:00
Dominik Jain b2f8f14b2e Restrict configuration file permissions on POSIX
- Set configuration permissions to 0600 before reading and log adjustments.
- Log chmod failures and continue loading; leave Windows permissions unchanged.
2026-09-17 16:12:58 +02:00
Dominik Jain 5a2063fc3a Add a persistent authentication secret to SerenaConfig
- Generate a random UUID when auth_secret is missing, null, or empty.
- Persist generated secrets and preserve configured values across reloads.
- Document the shared secret and test generation, persistence, and direct construction.
2026-09-17 14:28:02 +02:00
Dominik Jain 613f2ca098 Support writable external project contexts
- Rename the read-only context to read_project_context and add writable project_context.
- Dispatch LSP-backed edits remotely and enforce read-only access in the calling context.
- Allow project-server facade calls independently of the target project's API restrictions.
- Update dispatch coverage for both backends and access modes; remove obsolete rejection assertions.
2026-09-17 14:28:02 +02:00
Dominik Jain 602837b6e0 Fix language server cache directory
A language server's cache directory was determined by the language_id rather than
the language server identifier's key. The two identifiers coincided in most cases.
2026-09-17 12:15:43 +02:00
Dominik Jain 0b2b4c3b56 Add REPL-specific aspects to the security documentation 2026-09-17 10:58:14 +02:00
Dominik Jain da1accf7e1 Add documentation on the REPL interface
* Tools section: Add REPL interface description, advantages and full list of functions
* Config section: Add information on REPL configuration
2026-09-17 10:58:14 +02:00
Dominik Jain a0bc785e0a Improve facade method docstrings (such that first line is meaningful stand-alone) 2026-09-17 10:58:14 +02:00
Dominik Jain bf2ce28b0e Remove beta marker from JetBrains tools 2026-09-17 10:58:14 +02:00
Dominik Jain 4b54fa737f Introduce optional facades; make facade availability derived
Facade availability:
* facades can be optional (`Facade.from_api(..., is_optional=True)`), mirroring optional tools
* `Facade.is_enabled()` is derived: a facade is available iff it has at least one enabled method
* `ApiScope.is_facade_enabled` is thereby obsolete and removed

Opt-in rule (uniform for optional facades, excluded facades and optional methods):
* methods of a facade which is not included and optional methods require explicit inclusion
* all other methods are enabled unless explicitly excluded

Application:
* the `ext` facade is optional; the query-projects mode includes it (`included_apis: [ext]`)
2026-09-17 10:58:14 +02:00
Dominik Jain a5fd4d685f Fix: High-level document symbol cache was not invalidated when the LS-specific low-level version changed 2026-09-16 01:46:48 +02:00
Dominik Jain 680a7e8fc1 Improve REPL availability policy in memory 2026-09-15 16:28:30 +02:00
Dominik Jain 750deac10f SerenaConfig: Configure agent_interface default for existing users
To ensure backward compatibility, set the default to TOOLS when migrating
existing users' configuration files.
2026-09-15 16:28:30 +02:00
Dominik Jain 42ef92b616 Handle imports for backward compatibility using mark_used 2026-09-15 13:35:30 +02:00
Dominik Jain 988f20d5f5 Show interface, backend and REPL function availability in the dashboard
Configuration endpoint:
* ResponseConfigOverview: agent_interface, language_backend and facades (None in tool mode)
* facades report each facade and its methods with their enabled state (SerenaReplEntrypoint.get_facade_availability_info)

Dashboard UI:
* new rows "Interface" and "Backend"; "Languages" is shown for the LSP backend only
* new collapsible section "Active Functions" listing the facades and their methods, dimming disabled ones
2026-09-15 12:50:44 +02:00
Dominik Jain 323e855625 Allow language backend changes upon project activation with the REPL interface
* _activate_project: a project's backend override switches the backend in REPL mode (background
  modes, facades, prompt parameters and backend initialisation are recomputed upon activation)
* the tool interface keeps rejecting the mismatch (fixed toolset); the error now mentions the REPL
  as a workaround
2026-09-15 12:50:44 +02:00
Dominik Jain 4b9ce9ad44 Place the REPL's facade listing in the tool description or the activation message
* single-project sessions: in the REPL tool's description (fixed at registration)
* otherwise: in the project activation message (facades depend on the activated project)
* REPL tool description wording adjusted (listing location, notebook semantics)

Peripheral changes:
* is_tool_function_available: in REPL mode, active tools without facade counterparts count as available
2026-09-15 12:50:44 +02:00
Dominik Jain d76dc3d870 Refine commit message guidelines in critical_info memory
* subject line must cover the entire change (abstract if necessary)
* details as concise bullet items, grouped by topic where the change spans several topics
2026-09-15 12:50:44 +02:00
Dominik Jain e39291979e Check tool functionality availability independently of the agent interface
Availability check:
* SerenaAgent.is_tool_function_available(tool_class): whether a tool's functionality is available
  to the LLM (tool mode: tool active; REPL mode: an enabled facade method corresponds to the tool)
* replaces the name-based tool_is_active/tool_is_exposed (activation message, dashboard, onboarding)

Prompts:
* activation message names functions via PromptParams.get_function_name (interface-specific names)
2026-09-15 12:50:44 +02:00
Dominik Jain 0706e3c98e Add external project access to the REPL (ext facade, remote execution of LSP operations)
Introduce the ext facade with list_projects and project_context: within
`with s.ext.project_context(name):`, the facades operate read-only on the given external project.
The agent's active project is switched temporarily, and methods marked with
`@facade_method(uses_project_server=True)` (all lsp methods) are executed in the project server when
the LSP backend is active (with JetBrains, the IDE serves all projects, so they run locally). The
project server gains a /call_facade_method route executing a facade method on its own REPL facades
and returning the pickled result; arguments are transferred as JSON. Editing methods are refused,
and contexts cannot be nested. This replaces the query_project tools in the REPL.

Result objects are now self-contained (picklable): renderers no longer hold the agent (only the
default length limit; the constructor interface is unchanged), LSP results carry eagerly retrieved
symbol info and reference contexts instead of renderers accessing the language server or project.
2026-09-15 12:50:44 +02:00
Dominik Jain 1313bb5fc8 Execute REPL code like a notebook cell; the last expression is the result
Code is now executed at module level in the session's namespace (statements executed, a trailing
expression evaluated as the result), replacing the function wrapper with global declarations that
persistence had required. This yields notebook semantics throughout: top-level bindings persist by
construction, functions resolve names from the session namespace, and `return` is no longer used
(a top-level `return` yields a syntax error with a hint). Tool description and tests updated.
2026-09-15 12:50:44 +02:00
Dominik Jain 5cae1d8ddf Explain max_answer_chars centrally in the REPL tool description
The parameter is documented once in the tool description instead of in every facade method.
2026-09-15 12:50:44 +02:00
Dominik Jain 37dda68376 Persist REPL variables and functions across executions within a session
Code executions of a session now share a namespace (SerenaSession.repl_namespace), which serves as
the globals of the executions: variables, functions, classes and imports bound at the top level of
the submitted code persist across calls, like the cells of a notebook. The code is wrapped in a
function at the AST level (preserving line numbers for error reporting), with the top-level names
declared global. The entrypoint `s` is re-bound before every execution, such that persisted
functions always use the current entrypoint (e.g. after a project switch). `s.vars()` lists the
persisted items, `s.clear()` removes them; the tool description explains the persistence.

The namespace is tied to the session's lifetime; the session registry additionally evicts sessions
which have been idle for too long, releasing their namespaces.
2026-09-15 12:50:44 +02:00
Dominik Jain e6f0d7839c Drop ReferencedType declarations that discovery renders redundant
Only the three declarations carrying member curation remain (LanguageServerSymbol, ReplacementOccurrence, MatchedConsecutiveLines); the discovered type sets are unchanged.
2026-09-15 12:50:44 +02:00
Dominik Jain 44a283ee99 Make all types reachable through annotations documentable in the REPL
Facades now discover all user-defined classes reachable through the annotations of their methods and
of the members of reachable types (transitively) and make them documentable via s.info, without the
types having to be declared. Explicit ReferencedType declarations serve curation only (member
whitelists, flags). TypedDicts are documented with their keys (e.g. the JetBrains symbol DTOs and
the LSP diagnostic structures), enums with their members. SymbolKind no longer needs declaring.
2026-09-15 12:50:44 +02:00
Dominik Jain 8d1fb7424c Follow parameter annotations in REPL type documentation; support enums
Referenced types are now also discovered through the parameter annotations of type members and
facade methods (not only through return types), such that e.g. SymbolKind (a parameter type of
LanguageServerSymbol.iter_ancestors) is documented along with LanguageServerSymbol. Enums are
documented with their members and values. The lsp facade declares SymbolKind as a referenced type.
2026-09-15 12:50:44 +02:00
Dominik Jain 24b41dcb88 Add sessions to the REPL; document contained types once per session
Type documentation now transitively includes the declared types a type's members reference, such
that e.g. LspSymbolCollection's documentation includes LanguageServerSymbol. To avoid repeating widely
shared types, the REPL tracks per session which types have been documented: a contained type
documented earlier in the session is only pointed to (an explicit request always yields it in full).

Since MCP provides no reliable session identification and clients keep a stdio server across
conversations, the REPL's session identity is supplied by the LLM: the instructions (system prompt)
establish a SerenaSession and state its id, and the REPL tool takes a required session_id parameter.
Sessions are managed by a SessionRegistry (creation on demand, LRU eviction). Tools which may be
called before the instructions have been read (activate_project, initial_instructions) are unchanged.
2026-09-15 12:50:44 +02:00
Dominik Jain b067f5f71d Update Serena project 2026-09-15 12:50:44 +02:00
Dominik Jain b483bf0159 Structure REPL documentation into tiers; keep facade descriptions compact
The REPL overview (tier 0, part of the tool description) now names the result type of methods
returning objects that can be processed in code (e.g. `find_symbol -> LspSymbolCollection`), such
that type documentation can be requested alongside a facade in one turn.

The facade description (tier 1) documents the common operations in full, summarises methods marked
as niche (new flag of facade_method; not yet set anywhere) with a pointer to their documentation,
and lists result types by name only. Type documentation (tier 2) is provided on request only;
provide_info_with_facade remains available but is no longer set for any type.

The REPL tool description states this protocol, in particular that facade descriptions do not
include result types and that type documentation should only be requested for processing results in
code.
2026-09-15 12:50:44 +02:00
Dominik Jain 6cb3d37e09 Add referenced types to facades, making result types discoverable in the REPL
Facades declare the types their methods return or contain as ReferencedTypes (with an optional
whitelist of members for curation, e.g. for LanguageServerSymbol, and a flag for inclusion in the
facade description). Type documentation is generated from class docstrings, attribute annotations,
properties and method signatures/docstrings, and is available via s.info("<facade>.<Type>") or by
bare type name; method documentation points to the documentation of a referenced return type.
Annotations are rendered without module paths, such that the names in signatures are the names by
which types can be looked up. s.info accepts several items at once, reporting unknown items inline.

All APIs declare their result types; result classes declare their attributes at class level.
2026-09-15 12:50:44 +02:00
Dominik Jain 05603b2706 Add configuration facade (cfg) with get_current_config and open_dashboard
Introduce ConfigApi, exposing Serena's configuration and session state: get_current_config and
open_dashboard (both non-editing). The corresponding tools delegate to the API via ConfigApiMixin.

As on the tool side, opening the dashboard is only offered if the dashboard is enabled and not
opened automatically; the condition is shared (_is_dashboard_openable) and applied to the API scope
via a NamedApiInclusionDefinition, the API-side counterpart of NamedToolInclusionDefinition.
2026-09-15 12:50:44 +02:00
Dominik Jain 6716193d71 Render prompts according to the agent interface
Prompt parameters (available tools/markers and the tool name mapping) are now computed per agent
interface (SerenaAgent.PromptParams). In REPL mode, the available tools comprise the exposed tools
and the enabled facade methods, and the tool name mapping resolves tool names to the qualified names
of the corresponding facade methods (e.g. `lsp.find_symbol`), such that prompts refer to operations
as they are used in REPL code. The parameters are re-computed whenever the active tools change.

FacadeMethod refers to its parent facade and provides facade_name and qualified_name; its name is
taken from its info. Prompt templates use the tool name mapping consistently (fixing a template
syntax error in the editing mode) and use interface-neutral wording.
2026-09-15 12:50:44 +02:00
Dominik Jain 337d545c4b Add agent_interface setting selecting the tool or REPL interface
Introduce AgentInterface (tools/REPL) as a setting in the global configuration, overridable per
project (resolution: project > global > default "tools") and via the CLI option --agent-interface.
The interface is fixed for the session, like the language backend.

In REPL mode, the set of exposed tools is fixed: the REPL tool, initial_instructions and (unless in a
single-project session) activate_project. Tool inclusion/exclusion definitions do not apply in REPL
mode, as they pertain to the tool interface; the REPL is configured via API inclusions/exclusions.
The REPL tool is optional in tool mode.

SerenaAgent.is_single_project records whether the session is a single-project session.
2026-09-15 12:50:44 +02:00
Dominik Jain e7aa6a74e1 Add repl memory documenting the REPL's structure, principles and availability policy 2026-09-15 12:50:44 +02:00
Dominik Jain 07b6831c70 Record the correspondence between API methods and tools
FacadeMethodInfo gains corresponding_tool (the tool class offering the same functionality) and
get_corresponding_tool_name, and every API method with a tool counterpart names it in its
facade_method decorator. This enables applying tool-level exclusions to API methods and rendering
prompt conditions based on tools.

Since the API modules now refer to the tool classes, the tools import the APIs locally (in the
mixins' _api methods), and the symbol tools' symbol_dict_grouper attributes become properties.
2026-09-15 12:50:44 +02:00
Dominik Jain a46a465773 Add shell facade (shell) for shell command execution
Introduce ShellApi with the single editing operation execute_shell_command, which returns a
ShellCommandOutput exposing stdout, stderr, return code and working directory to code and rendering
as JSON as before. Keeping shell command execution in its own facade makes it a natural unit for
exclusion. The shell command tool delegates to the API via ShellApiMixin; the shell facade is always
part of the REPL.
2026-09-15 12:50:44 +02:00
Dominik Jain 5f129628d9 Add file system facade (fs); create_text_file moves there from edit
Introduce FsApi, exposing operations on the project's files as units: read_file, create_text_file,
list_dir, find_file and search_for_pattern. The boundary to the edit facade, which modifies content
within existing files, is stated in the facade description. Results expose their data to code
(FileContent, DirectoryListing, PatternMatches) and render as before; the pattern search's
shortening ladder moves from the tool into PatternMatchesRenderer.

The file tools delegate to the API via FsApiMixin. The fs facade is always part of the REPL.
2026-09-15 12:50:44 +02:00
Dominik Jain c0e74c7d7e Describe facades by domain rather than by listing operations
The method list accompanies every facade description, so naming operations in it was redundant.
2026-09-15 12:50:44 +02:00
Dominik Jain 8e4d68cd40 Add memory facade (mem) including onboarding
Introduce MemoryApi, exposing the memory operations list_memories, read_memory, write_memory,
edit_memory, rename_memory and delete_memory (the latter four marked as editing operations) as well
as onboarding, which provides the onboarding instructions. list_memories returns a MemoryList, which
exposes the (writable and read-only) memory names to code and renders as JSON.

The memory tools and the onboarding tool delegate to the API via MemoryApiMixin; the onboarding tool
retains its check for the availability of the memory writing tool. The mem facade is always part of
the REPL.

The modes no-onboarding, no-memories and benchmark exclude the corresponding APIs (mem.onboarding,
or the mem facade as a whole), mirroring their tool exclusions.
2026-09-15 12:50:44 +02:00
Dominik Jain d9cda96725 Add instructions on commit messages 2026-09-15 12:50:44 +02:00
Dominik Jain f38f12915b Enable ty's unresolved-import rule
Broken first-party imports previously went undetected, since the rule was globally disabled to
accommodate optional extras and platform-specific modules. These are now handled narrowly:
per-file overrides for the agno integration (optional extra, not installed in CI) and for the
pywebview integration (several macOS-only imports), and an inline suppression for the single
macOS-only import in the dashboard.
2026-09-15 12:50:44 +02:00
Dominik Jain fee1aef934 Rename package facades to repl and API modules to *_api 2026-09-15 12:50:44 +02:00
Dominik Jain 66ed46bef4 Add editing facade (edit) covering the backend-independent edit operations
Introduce EditApi as the facade for editing operations which depend
only on the code editor abstraction and thus work with any language
backend: create_text_file, replace_content, replace_in_files, the
optional line-level operations delete_lines, replace_lines and
insert_at_line, and the symbol-level operations replace_symbol_body,
insert_after_symbol and insert_before_symbol (moved from LspApi, which
retains the LSP-specific rename_symbol and safe_delete_symbol).

replace_in_files builds on MultiFileReplacement: a dry run returns a
ReplacementPreview, which exposes the occurrences to code and renders
the listing of prospective changes; rejections raise a ValueError
carrying the listing where applicable.

FacadeApi gains a backend-agnostic _create_code_editor; the LSP API's
retriever-based factory is renamed to _create_ls_code_editor. The
editing tools (file and symbol level) delegate to EditApi via
EditApiMixin, retaining only the diagnostics context. The edit facade
is always part of the REPL.
2026-09-15 12:50:43 +02:00
Dominik Jain 8ace53c3a1 Extract multi-file replacement logic from ReplaceInFilesTool
Introduce MultiFileReplacement (in serena.util.text_utils, alongside
MultiFileContentReplacer), which owns the logic previously spread over
the tool's private methods: resolving the files in scope (via the
project's file collection and glob filtering, which the tool had
re-implemented), finding occurrences, resolving occurrence ids with
diagnostics, the safety checks for blind application (no matches,
expected count, ambiguous matches), rendering the listing of
prospective changes and applying the selected occurrences. Rejections
are signalled via ReplacementRejectedError, which indicates whether
the listing should accompany the message, leaving presentation
(listing, length limit, diagnostics context) to the tool.

EditedFileContext moves from tools_base to code_editor, where it
belongs (re-exported from serena.tools); Project.create_file_collection
is now public; Tool gains _resolve_max_answer_chars.
2026-09-15 12:50:43 +02:00
Dominik Jain 9b0f6cf97a Restore symbol_dict_grouper attributes on the symbol tools
The attribute is the tools' public handle for disabling grouping (disabled_context()),
used by the health check and tests.
2026-09-15 12:50:43 +02:00
Dominik Jain eabc7e60d6 Add facade method metadata and API scope configuration for the REPL
Facade methods are now declared explicitly via the facade_method
decorator, which attaches FacadeMethodInfo (optional, beta, can_edit)
mirroring the tool markers; undecorated methods are never exposed.
All LspApi and JetBrainsApi methods are decorated accordingly
(JetBrains methods are non-optional, as the facade only exists with
the JetBrains backend).

Which facades/methods are enabled is determined by an ApiScope, which
is built by applying ApiInclusionDefinitions (included_apis,
excluded_apis, referencing facades or facade methods such as "lsp" or
"lsp.find_symbol") from the global configuration, the context, the
active modes and the project configuration, in that order. Optional
methods and all methods of an excluded facade must be included
explicitly; other methods are enabled unless excluded. For read-only
projects, editing methods are excluded. The entrypoint omits facades
which are not enabled.

The REPL is re-created whenever the active tools are updated (mode
switch, project activation), as it depends on the same configuration.
The new settings are read from project.yml and documented in all
configuration templates.
2026-09-15 12:50:43 +02:00
Dominik Jain 91c2ec8dc2 Add remaining LSP operations to the lsp facade; tools delegate to LspApi
LspApi now covers all language server-backed operations:
restart_language_server, get_symbols_overview, find_symbol,
find_referencing_symbols, find_implementations, find_declaration,
get_diagnostics_for_file, get_diagnostics_for_symbol,
replace_symbol_body, insert_after_symbol, insert_before_symbol,
rename_symbol and safe_delete_symbol.

Result objects carry their rendering policy:
* LspSymbolCollectionRenderer was generalised (symbol_dicts_,
  child_inclusion_predicate) and is reused by find_implementations
* LspSymbolsOverviewRenderer renders a file's overview with the
  depth-0/kind-count shortening ladder
* LspSymbol/LspSymbolRenderer represent a single symbol
  (find_declaration), preserving the dict output shape
* LspReferenceCollection with its renderer (context lines, per-file
  counts, total count)
* LspDiagnostics wrapping GroupedDiagnostics

The symbol tools are now thin adapters which delegate to the API via
the LspApiMixin (the JetBrains tools use JetBrainsApiMixin
analogously, replacing the intermediate tool base class). Editing
tools retain the DiagnosticsContext wrapper, which the API does not
use; DiagnosticsContext moved to serena.lsp.lsp_diagnostics and is
created via EditingToolWithDiagnostics.diagnostics_context.

SUCCESS_RESULT moved to serena.facades.facade (the API cannot import
from serena.tools without an import cycle); serena.tools re-exports it.
The project health check in the CLI uses LspApi directly instead of
tool internals. iter_subclasses now yields each class once.
2026-09-15 12:50:43 +02:00
Dominik Jain eb53a4cee4 Add JetBrains facade (jb) covering all JetBrains tools
Introduce JetBrainsApi as the second facade implementation, exposing
all JetBrains IDE-backed operations to the REPL: find_symbol,
find_referencing_symbols, get_symbols_overview, get_type_hierarchy,
find_declaration, find_implementations, rename, move, safe_delete,
inline_symbol, run_inspections, list_inspections, debug_eval and
debug_eval_info (which provides the debug REPL usage information
otherwise obtained via the serena_info tool).

Result objects carry their rendering policy, following the LSP facade:
* JetBrainsSymbolCollection with renderers for symbol searches
  (grouped JSON, falling back to identifiers) and references (falling
  back to per-file counts and the total count)
* JetBrainsSymbolsOverview with the compact overview format and its
  shortening ladder
* JsonObject, a new general-purpose representable for plain JSON
  results with length limiting

The JetBrains tools now delegate to the API via a common JetBrainsTool
base, retaining only transport concerns (input sanitisation, the
wildcard-to-overview convenience of the find symbol tool), so that
both surfaces share one implementation. The agent adds the facade to
the REPL when the JetBrains backend is active.

serena_config imported JetBrainsPluginClient through a transitive
re-export from jetbrains_tools; it now imports it from its module.
2026-09-15 10:27:45 +02:00
Dominik Jain 2c9640c3ad Add REPL-based interaction paradigm with a first facade (lsp.find_symbol)
Introduce an alternative to individual tool calls: a single tool
(serena_repl) executes Python code against an entrypoint object `s`,
which exposes Serena's functionality through facades. This lets the
LLM compose operations, filter results in code and return only what
it needs, keeping intermediate data out of the context window.

Facades (serena.facades):
* FacadeApi: base class for implementations. Member naming determines
  LLM visibility: regular names are LLM-facing, a trailing underscore
  marks members that are public within Serena but never exposed to the
  LLM, a leading underscore is private.
* Facade: indirection over a FacadeApi instance (Facade.from_api),
  holding one FacadeMethod per LLM-facing method, each of which can be
  enabled or disabled independently; only enabled methods are
  accessible from REPL code and included in the documentation.
* SerenaRepl/SerenaReplEntrypoint: execute code as the body of a
  function (`return` defines the result; a single expression is
  evaluated directly), render the result via Representable and
  report errors with the line within the submitted code. Progressive
  disclosure via s.info(): the tool description and s.info() list the
  facades with their method names only; s.info("<facade>") and
  s.info("<facade>.<method>") provide signatures together with
  docstrings, never signatures alone.
* Representable/Renderer: result objects carry their rendering policy.
  Output parameters are passed at retrieval time so that they are
  inherited by derived results.

First facade: LspApi with find_symbol, returning an LspSymbolCollection
which renders as the familiar JSON (with grouping and progressive
shortening) while exposing the underlying symbols to code.
FindSymbolTool now delegates to LspApi, so both surfaces share one
implementation. Length limiting and JSON output were moved from Tool
into TextOutputUtils so that facades can use them.

The agent creates the REPL lazily (get_repl) and resets it on project
activation. The tool is marked beta.

Also fixes pre-existing type errors (get_tool return type, invariant
list annotations in symbol_tools, test stubs) found on the way.
2026-09-15 10:27:45 +02:00
Dominik Jain 8fc68d4c6e Set version to v2.0.0.dev0 2026-09-15 10:27:45 +02:00
Dominik Jain 6da423c70a Add dev command to bump_version and make its interface explicit
bump_version could previously only create releases. It now provides two
subcommands, and the mutually exclusive --major/--minor/--patch flags (as
well as the explicit --version option) are replaced by a positional
argument, which cannot be misused:

    bump_version.py release <current|major|minor|patch>
    bump_version.py dev <major|minor|patch>

`dev` bumps the version to a new .dev0 version and commits it as
"Set version to vX" without creating a tag or touching the changelog. This
allows work on main to target a new minor/major version independently of a
release.

Because a .dev0 version no longer necessarily reserves the next patch
version, `release` now takes the target "current", which releases the
version reserved by the current .dev version (the usual case), whereas
major/minor/patch bump beyond it. The former special case of not
incrementing the patch version is thereby removed; `release patch` now
increments the patch version as its name suggests.

`release current` fails if the current version is not a development
version, in which case there is no reserved version to release.
2026-09-15 10:27:45 +02:00
Dominik Jain 18fa47bfcc Merge branch 'gpl' 2026-09-14 21:35:06 +02:00
Dominik Jain 6707cd9b7e Introduce component-based licensing: Serena GPL-3.0-or-later, SolidLSP MIT
The repository is licensed per component. SolidLSP (src/solidlsp,
test/solidlsp, test/resources) remains MIT-licensed and independently
reusable; the Serena application (src/serena, src/interprompt, scripts,
test/serena, docs) is licensed under GPL-3.0-or-later starting with the v2
licensing transition. The change is not retroactive: all releases and
commits up to v1.7.0 / 74c38a65 (tag mit-final) remain available under MIT.

Since MIT is GPL-compatible, a distribution combining both (such as the
serena-agent package) is as a whole subject to GPL-3.0-or-later, while the
SolidLSP files themselves stay MIT and can be extracted and used separately
under MIT terms. The distribution metadata therefore declares
GPL-3.0-or-later, with both license texts shipped alongside it.

Serena originally began under the GPL (v2) and was switched to MIT in
May 2025 following community requests. We consider that change a mistake;
the substantial changes in v2 make this the appropriate time to revert it.
We want the best version of Serena to remain free.

Changes:
* LICENSE is now the licensing overview; canonical license texts live in
  LICENSES/ (MIT.txt is the previous LICENSE verbatim, GPL-3.0-or-later.txt
  is the unmodified FSF text)
* pyproject.toml declares the PEP 639 license expression
  "GPL-3.0-or-later" and bundles LICENSE and LICENSES/* as license files;
  the deprecated MIT classifier is dropped and flake.nix declares gpl3Plus;
  README has per-component license badges and a License section
* SPDX-License-Identifier headers in all Python sources under src/ and
  scripts/, added by the new idempotent scripts/add_spdx_headers.py, which
  gen_prompt_factory.py also uses to keep the header on the generated
  module; existing third-party notices are preserved
* CLA.md: Contributor License Agreement (contributor retains copyright;
  grants a perpetual, irrevocable license including relicensing under any
  terms, incl. proprietary/commercial; patent grant; authority
  representations), to be enforced repository-wide via cla-assistant.io
* CONTRIBUTING.md, PR template and a new docs page explain the licensing
  boundary and the CLA workflow
2026-09-14 21:33:18 +02:00
Dominik Jain 74c38a65f0 Require issue to be real 2026-09-14 17:56:23 +02:00
Dr. Dominik Jain 403ad0a562 Merge pull request #1988 from oraios/ls-registry
SolidLSP: Add language server registry, supporting externally provided implementations
2026-09-12 23:16:52 +02:00
Dominik Jain 283140e7ae Refactor external language server registration
* Apply object-oriented design
* Establish common interface via protocol LanguageServerIdLike
* Move all registration concerns to LanguageServerRegistry
2026-09-12 15:15:34 +02:00
Dominik Jain c1ca4324d1 Improve docstring 2026-09-08 11:44:56 +02:00
Dominik Jain d645bbb0e1 Update AGENTS.md and CLAUDE.md
Add instructions that allow agents not using Serena to get at
least the most essential information
2026-09-08 11:32:56 +02:00
Dominik Jain 9f9db76622 Fix document symbol caching for language servers that post-process symbols
Caching happened in the base implementation before subclass overrides could
post-process the result, so an override's work was either never cached or,
if it mutated in place, re-applied to cached output on every hit.

Restructure both symbol caches so that they wrap the subclass logic:
subclasses now post-process via dedicated hooks (`_request_raw_document_symbols`
and `_build_document_symbols_from_raw_symbols`), and the cached value is
the fully processed result. Cache versions are bumped where the cached
content changes as a consequence.
2026-09-06 13:51:53 +02:00
Dominik Jain 7cde558158 Remove test_jetbrains_launch_coordinator 2026-09-06 11:24:20 +02:00
Dominik Jain 801a388c2b Remove unnecessary platform restrictions in language servers
Platform checks in the following language servers are affected:
* Elixir Tools
* Intelephense
* Perl
* TypeScript
* VTS
2026-09-03 18:35:07 +02:00
Dominik Jain 813fd98f4f CLI: Fix project index-file command not using only the relevant language server to index the given file
Resolves #1965
2026-09-02 15:12:16 +02:00
Dr. Dominik Jain c8ef9d358e Merge pull request #1872 from AmirF194/fix/1871-nextflow-scan-flush-flag
fix(nextflow): don't mark workspace scan flushed when both probes fail
2026-09-02 13:46:24 +02:00
Dr. Dominik Jain f41f33c904 Merge branch 'main' into fix/1871-nextflow-scan-flush-flag 2026-09-02 13:06:49 +02:00
Dominik Jain 43ae0211d7 Fix: read_only restriction in project definition was not applied to base tool set when in single-project context
Fixes #1938
2026-08-30 17:37:14 +02:00
Dominik Jain 93ec043105 Updated interprompt sync commit identifiers (push) 2026-08-14 20:50:47 +02:00
Dominik Jain 1814fc9a0f interprompt edbee70392dca692d36d136c47a61513f4a2b222
commit edbee70392dca692d36d136c47a61513f4a2b222
  Author: Dominik Jain <[email protected]>
  Date:   Fri Aug 14 20:49:45 2026 +0200

      Sync reframer

        commit 8f0e933cca9481a57ccabf1ef9419815274cdfa1
        Author: Dominik Jain <[email protected]>
        Date:   Fri Aug 14 19:56:51 2026 +0200

            Allow to configure name of generated class

        reframer/interprompt/prompt_factory.py

        commit 7eb3472cec8179a19e1f127ecbdeadf50becab01
        Author: Dominik Jain <[email protected]>
        Date:   Fri Aug 14 19:48:49 2026 +0200

            Allow to configure interprompt package name and fix imports in generated code (must include PromptList)

        reframer/interprompt/prompt_factory.py

        commit 015781ed2b6b0e2311d9938788403e0b33b19e17
        Author: Dominik Jain <[email protected]>
        Date:   Fri Aug 14 19:36:07 2026 +0200

            Fix: Language code was read at the wrong level

        reframer/interprompt/multilang_prompt.py

        commit 487e9eed63d435257ee03eda03e668b4e7a73019
        Author: Dominik Jain <[email protected]>
        Date:   Fri Aug 14 19:08:18 2026 +0200

            Use relative imports

        reframer/interprompt/jinja_template.py

  src/interprompt/jinja_template.py
  src/interprompt/multilang_prompt.py
  src/interprompt/prompt_factory.py
2026-08-14 20:50:47 +02:00
Dominik Jain 3ad624f511 Merge branch 'main' of github.com:oraios/serena 2026-08-14 15:57:04 +02:00
Dominik Jain 36e5e981e7 Updated interprompt sync commit identifiers (pull) 2026-08-14 15:56:20 +02:00
Dominik Jain 17e39c9655 Fix duplicate section 2026-08-14 15:46:51 +02:00
Dominik Jain 25610cb280 Improve docstrings 2026-08-13 13:10:37 +02:00
Dominik Jain 8a4d116c13 Fix: Parallel agents auto-registering projects could overwrite each other's changes
to the global project list in `serena_config.yml`

Fixes #1850
2026-08-13 12:21:45 +02:00
Dominik Jain f1d78a88ce Update docstring of web_dashboard_interface 2026-08-10 19:02:05 +02:00
Dr. Dominik Jain 946ad98178 Merge pull request #1836 from oraios/release-1.7
Release v1.7.0
2026-08-09 20:37:45 +02:00
Dominik Jain 2cb9d87227 Set version to v1.7.1.dev0 2026-08-09 20:14:38 +02:00
Dominik Jain 949a27ef1e Release v1.7.0 2026-08-09 20:14:37 +02:00
Dominik Jain be5cf4e41e Merge remote-tracking branch 'origin/main' into release-1.7 2026-08-09 20:13:17 +02:00
Dr. Dominik Jain 3c8e9854f6 Improve identification of container/low-level symbols (#1834)
This affects results returned for request_containing_symbol,
some tests were adjusted accordingly.
2026-08-09 20:12:51 +02:00
Dominik Jain bad11d825c Update news item 2026-08-09 17:51:16 +02:00
Dominik Jain 140d0b03ee Merge branch 'main' into release-1.7 2026-08-09 17:42:14 +02:00
Dr. Dominik Jain 281e9db2eb Merge pull request #1823 from AmirF194/fix/1818-process-group-cleanup-without-enumeration 2026-08-09 17:37:16 +02:00