mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 20:17:42 +00:00
Revert "SerenaAgentMode.from_name: Allow loading an internal mode (if explicitly requested)"
This reverts commit 7e138397d3.
This commit is contained in:
1 parent
f4ab15da98
commit
946b0e7d51
1 file changed
+3
-11
@@ -70,7 +70,7 @@ class SerenaAgentMode(ToolInclusionDefinition, ToStringMixin):
|
||||
own_yaml_path = os.path.join(SERENAS_OWN_MODE_YAMLS_DIR, fname)
|
||||
if not os.path.exists(own_yaml_path):
|
||||
raise FileNotFoundError(
|
||||
f"Mode {name} not found in {SerenaPaths().user_modes_dir} or in {SERENAS_OWN_MODE_YAMLS_DIR}. "
|
||||
f"Mode {name} not found in {SerenaPaths().user_modes_dir} or in {SERENAS_OWN_MODE_YAMLS_DIR}."
|
||||
f"Available modes:\n{cls.list_registered_mode_names()}"
|
||||
)
|
||||
return own_yaml_path
|
||||
@@ -78,16 +78,8 @@ class SerenaAgentMode(ToolInclusionDefinition, ToStringMixin):
|
||||
@classmethod
|
||||
def from_name(cls, name: str) -> Self:
|
||||
"""Load a registered Serena mode."""
|
||||
try:
|
||||
mode_path = cls.get_path(name)
|
||||
return cls.from_yaml(mode_path)
|
||||
except:
|
||||
try:
|
||||
# Allow loading an internal mode if it is explicitly requested
|
||||
return cls.from_name_internal(name)
|
||||
except:
|
||||
pass
|
||||
raise
|
||||
mode_path = cls.get_path(name)
|
||||
return cls.from_yaml(mode_path)
|
||||
|
||||
@classmethod
|
||||
def from_name_internal(cls, name: str) -> Self:
|
||||
|
||||
Reference in new issue
Block a user