mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-29 23:41:35 +08:00
Compare commits
1 Commits
fix/plugin
...
hermes/her
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d32dae165 |
24
cli.py
24
cli.py
@@ -2837,6 +2837,28 @@ class HermesCLI:
|
|||||||
print(" Example: python cli.py --toolsets web,terminal")
|
print(" Example: python cli.py --toolsets web,terminal")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
def _handle_profile_command(self):
|
||||||
|
"""Display active profile name and home directory."""
|
||||||
|
from hermes_constants import get_hermes_home, display_hermes_home
|
||||||
|
|
||||||
|
home = get_hermes_home()
|
||||||
|
display = display_hermes_home()
|
||||||
|
|
||||||
|
profiles_parent = Path.home() / ".hermes" / "profiles"
|
||||||
|
try:
|
||||||
|
rel = home.relative_to(profiles_parent)
|
||||||
|
profile_name = str(rel).split("/")[0]
|
||||||
|
except ValueError:
|
||||||
|
profile_name = None
|
||||||
|
|
||||||
|
print()
|
||||||
|
if profile_name:
|
||||||
|
print(f" Profile: {profile_name}")
|
||||||
|
else:
|
||||||
|
print(" Profile: default")
|
||||||
|
print(f" Home: {display}")
|
||||||
|
print()
|
||||||
|
|
||||||
def show_config(self):
|
def show_config(self):
|
||||||
"""Display current configuration with kawaii ASCII art."""
|
"""Display current configuration with kawaii ASCII art."""
|
||||||
# Get terminal config from environment (which was set from cli-config.yaml)
|
# Get terminal config from environment (which was set from cli-config.yaml)
|
||||||
@@ -3679,6 +3701,8 @@ class HermesCLI:
|
|||||||
return False
|
return False
|
||||||
elif canonical == "help":
|
elif canonical == "help":
|
||||||
self.show_help()
|
self.show_help()
|
||||||
|
elif canonical == "profile":
|
||||||
|
self._handle_profile_command()
|
||||||
elif canonical == "tools":
|
elif canonical == "tools":
|
||||||
self._handle_tools_command(cmd_original)
|
self._handle_tools_command(cmd_original)
|
||||||
elif canonical == "toolsets":
|
elif canonical == "toolsets":
|
||||||
|
|||||||
@@ -1865,6 +1865,9 @@ class GatewayRunner:
|
|||||||
if canonical == "commands":
|
if canonical == "commands":
|
||||||
return await self._handle_commands_command(event)
|
return await self._handle_commands_command(event)
|
||||||
|
|
||||||
|
if canonical == "profile":
|
||||||
|
return await self._handle_profile_command(event)
|
||||||
|
|
||||||
if canonical == "status":
|
if canonical == "status":
|
||||||
return await self._handle_status_command(event)
|
return await self._handle_status_command(event)
|
||||||
|
|
||||||
@@ -3055,6 +3058,36 @@ class GatewayRunner:
|
|||||||
return f"{header}\n\n{session_info}"
|
return f"{header}\n\n{session_info}"
|
||||||
return header
|
return header
|
||||||
|
|
||||||
|
async def _handle_profile_command(self, event: MessageEvent) -> str:
|
||||||
|
"""Handle /profile — show active profile name and home directory."""
|
||||||
|
from hermes_constants import get_hermes_home, display_hermes_home
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
home = get_hermes_home()
|
||||||
|
display = display_hermes_home()
|
||||||
|
|
||||||
|
# Detect profile name from HERMES_HOME path
|
||||||
|
# Profile paths look like: ~/.hermes/profiles/<name>
|
||||||
|
profiles_parent = Path.home() / ".hermes" / "profiles"
|
||||||
|
try:
|
||||||
|
rel = home.relative_to(profiles_parent)
|
||||||
|
profile_name = str(rel).split("/")[0]
|
||||||
|
except ValueError:
|
||||||
|
profile_name = None
|
||||||
|
|
||||||
|
if profile_name:
|
||||||
|
lines = [
|
||||||
|
f"👤 **Profile:** `{profile_name}`",
|
||||||
|
f"📂 **Home:** `{display}`",
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
lines = [
|
||||||
|
"👤 **Profile:** default",
|
||||||
|
f"📂 **Home:** `{display}`",
|
||||||
|
]
|
||||||
|
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
async def _handle_status_command(self, event: MessageEvent) -> str:
|
async def _handle_status_command(self, event: MessageEvent) -> str:
|
||||||
"""Handle /status command."""
|
"""Handle /status command."""
|
||||||
source = event.source
|
source = event.source
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ COMMAND_REGISTRY: list[CommandDef] = [
|
|||||||
aliases=("q",), args_hint="<prompt>"),
|
aliases=("q",), args_hint="<prompt>"),
|
||||||
CommandDef("status", "Show session info", "Session",
|
CommandDef("status", "Show session info", "Session",
|
||||||
gateway_only=True),
|
gateway_only=True),
|
||||||
|
CommandDef("profile", "Show active profile name and home directory", "Info"),
|
||||||
CommandDef("sethome", "Set this chat as the home channel", "Session",
|
CommandDef("sethome", "Set this chat as the home channel", "Session",
|
||||||
gateway_only=True, aliases=("set-home",)),
|
gateway_only=True, aliases=("set-home",)),
|
||||||
CommandDef("resume", "Resume a previously-named session", "Session",
|
CommandDef("resume", "Resume a previously-named session", "Session",
|
||||||
|
|||||||
Reference in New Issue
Block a user