mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-12 20:15:56 +00:00
Removed check_onboarding_performed, instead add a hint to activation message
This commit is contained in:
1 parent
d4c460583b
commit
04198c2a5e
7 files changed
+29
-51
No files matched your search
@@ -47,6 +47,7 @@ from serena.task_executor import TaskExecutor
|
||||
from serena.tools import (
|
||||
ActivateProjectTool,
|
||||
GetCurrentConfigTool,
|
||||
OnboardingTool,
|
||||
OpenDashboardTool,
|
||||
ReadMemoryTool,
|
||||
ReplaceContentTool,
|
||||
@@ -981,6 +982,8 @@ class SerenaAgent:
|
||||
f"\n{json.dumps(project_memories.to_dict())}\n"
|
||||
+ "Use the `read_memory` tool to read these memories later if they are relevant to the task."
|
||||
)
|
||||
elif self._active_tools.contains_tool_class(OnboardingTool):
|
||||
msg += "Onboarding has not been performed yet, you should call Serena's `onboarding` tool now to set up project memories."
|
||||
|
||||
# add prompts for modes that were dynamically activated by the project
|
||||
modes_with_prompts = self._project_prompt_status.get_modes_with_prompts_to_be_provided_for_project_activation(session_id)
|
||||
|
||||
@@ -14,31 +14,39 @@ class PromptFactory(PromptFactoryBase):
|
||||
"""
|
||||
|
||||
def get_info_jet_brains_debug_repl_template_string(self) -> str:
|
||||
return self.get_prompt_template_string('info_jet_brains_debug_repl')
|
||||
|
||||
return self.get_prompt_template_string("info_jet_brains_debug_repl")
|
||||
|
||||
def create_info_jet_brains_debug_repl(self) -> str:
|
||||
return self._render_prompt('info_jet_brains_debug_repl', locals())
|
||||
return self._render_prompt("info_jet_brains_debug_repl", locals())
|
||||
|
||||
def get_onboarding_prompt_template_string(self) -> str:
|
||||
return self.get_prompt_template_string('onboarding_prompt')
|
||||
|
||||
return self.get_prompt_template_string("onboarding_prompt")
|
||||
|
||||
def create_onboarding_prompt(self, *, memory_maintenance_name: Any, system: Any) -> str:
|
||||
return self._render_prompt('onboarding_prompt', locals())
|
||||
return self._render_prompt("onboarding_prompt", locals())
|
||||
|
||||
def get_connection_prompt_template_string(self) -> str:
|
||||
return self.get_prompt_template_string('connection_prompt')
|
||||
|
||||
return self.get_prompt_template_string("connection_prompt")
|
||||
|
||||
def create_connection_prompt(self) -> str:
|
||||
return self._render_prompt('connection_prompt', locals())
|
||||
return self._render_prompt("connection_prompt", locals())
|
||||
|
||||
def get_system_prompt_template_string(self) -> str:
|
||||
return self.get_prompt_template_string('system_prompt')
|
||||
|
||||
def create_system_prompt(self, *, available_markers: Any, available_tools: Any, context_system_prompt: Any, global_memories_list: Any, mode_system_prompts: Any) -> str:
|
||||
return self._render_prompt('system_prompt', locals())
|
||||
return self.get_prompt_template_string("system_prompt")
|
||||
|
||||
def create_system_prompt(
|
||||
self,
|
||||
*,
|
||||
available_markers: Any,
|
||||
available_tools: Any,
|
||||
context_system_prompt: Any,
|
||||
global_memories_list: Any,
|
||||
mode_system_prompts: Any,
|
||||
) -> str:
|
||||
return self._render_prompt("system_prompt", locals())
|
||||
|
||||
def get_cc_system_prompt_override_template_string(self) -> str:
|
||||
return self.get_prompt_template_string('cc_system_prompt_override')
|
||||
|
||||
return self.get_prompt_template_string("cc_system_prompt_override")
|
||||
|
||||
def create_cc_system_prompt_override(self) -> str:
|
||||
return self._render_prompt('cc_system_prompt_override', locals())
|
||||
return self._render_prompt("cc_system_prompt_override", locals())
|
||||
@@ -9,4 +9,3 @@ excluded_tools:
|
||||
- rename_memory
|
||||
- list_memories
|
||||
- onboarding
|
||||
- check_onboarding_performed
|
||||
@@ -3,4 +3,3 @@ prompt: |
|
||||
The onboarding process is not applied.
|
||||
excluded_tools:
|
||||
- onboarding
|
||||
- check_onboarding_performed
|
||||
@@ -528,6 +528,7 @@ class ToolRegistry:
|
||||
"summarize_changes",
|
||||
"think_about_whether_you_are_done",
|
||||
"switch_modes",
|
||||
"check_onboarding_performed",
|
||||
]
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
@@ -4,38 +4,7 @@ Tools supporting the general workflow of the agent
|
||||
|
||||
import platform
|
||||
|
||||
from serena.tools import ReadMemoryTool, Tool, ToolMarkerDoesNotRequireActiveProject, ToolMarkerOptional, WriteMemoryTool
|
||||
|
||||
|
||||
class CheckOnboardingPerformedTool(Tool):
|
||||
"""
|
||||
Checks whether project onboarding was already performed.
|
||||
"""
|
||||
|
||||
def apply(self) -> str:
|
||||
"""
|
||||
Checks whether project onboarding was already performed.
|
||||
You should always call this tool before beginning to actually work on the project/after activating a project.
|
||||
"""
|
||||
read_memory_tool_available = self.agent.tool_is_exposed(ReadMemoryTool.get_name_from_cls())
|
||||
perform_onboarding_tool_available = self.agent.tool_is_exposed(OnboardingTool.get_name_from_cls())
|
||||
|
||||
if not read_memory_tool_available:
|
||||
return "Memory reading tool not activated, skipping onboarding check."
|
||||
project_memories = self.memories_manager.list_project_memories()
|
||||
if len(project_memories) == 0:
|
||||
msg = "Onboarding not performed yet (no memories available). "
|
||||
if perform_onboarding_tool_available:
|
||||
msg += "You should perform onboarding by calling the `onboarding` tool before proceeding with the task. "
|
||||
else:
|
||||
# Not reporting the list of memories here, as they were already reported at project activation
|
||||
# (with the system prompt if the project was activated at startup)
|
||||
msg = (
|
||||
f"Onboarding was already performed: {len(project_memories)} project memories are available. "
|
||||
"Consider reading memories if they appear relevant to the task at hand."
|
||||
)
|
||||
msg += " If you have not read the 'Serena Instructions Manual', do so now."
|
||||
return msg
|
||||
from serena.tools import Tool, ToolMarkerDoesNotRequireActiveProject, ToolMarkerOptional, WriteMemoryTool
|
||||
|
||||
|
||||
class OnboardingTool(Tool):
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
# execute `uv run scripts/print_tool_overview.py`.
|
||||
#
|
||||
# * `activate_project`: Activates a project by name.
|
||||
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
|
||||
# * `create_text_file`: Creates/overwrites a file in the project directory.
|
||||
# * `delete_lines`: Deletes a range of lines within a file.
|
||||
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
|
||||
|
||||
Reference in new issue
Block a user