mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
fix(gateway): use profile-aware Hermes paths in runtime hints
This commit is contained in:
parent
5ef0fe1665
commit
77435c4f13
5 changed files with 34 additions and 3 deletions
|
|
@ -4990,6 +4990,7 @@ class GatewayRunner:
|
|||
async def _handle_personality_command(self, event: MessageEvent) -> str:
|
||||
"""Handle /personality command - list or set a personality."""
|
||||
import yaml
|
||||
from hermes_constants import display_hermes_home
|
||||
|
||||
args = event.get_command_args().strip().lower()
|
||||
config_path = _hermes_home / 'config.yaml'
|
||||
|
|
@ -5007,7 +5008,7 @@ class GatewayRunner:
|
|||
personalities = {}
|
||||
|
||||
if not personalities:
|
||||
return "No personalities configured in `~/.hermes/config.yaml`"
|
||||
return f"No personalities configured in `{display_hermes_home()}/config.yaml`"
|
||||
|
||||
if not args:
|
||||
lines = ["🎭 **Available Personalities**\n"]
|
||||
|
|
|
|||
|
|
@ -301,6 +301,8 @@ def build_session_context_prompt(
|
|||
lines.append("")
|
||||
lines.append("**Delivery options for scheduled tasks:**")
|
||||
|
||||
from hermes_constants import display_hermes_home
|
||||
|
||||
# Origin delivery
|
||||
if context.source.platform == Platform.LOCAL:
|
||||
lines.append("- `\"origin\"` → Local output (saved to files)")
|
||||
|
|
@ -311,7 +313,9 @@ def build_session_context_prompt(
|
|||
lines.append(f"- `\"origin\"` → Back to this chat ({_origin_label})")
|
||||
|
||||
# Local always available
|
||||
lines.append("- `\"local\"` → Save to local files only (~/.hermes/cron/output/)")
|
||||
lines.append(
|
||||
f"- `\"local\"` → Save to local files only ({display_hermes_home()}/cron/output/)"
|
||||
)
|
||||
|
||||
# Platform home channels
|
||||
for platform, home in context.home_channels.items():
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ AUTHOR_MAP = {
|
|||
"balyan.sid@gmail.com": "balyansid",
|
||||
"oluwadareab12@gmail.com": "bennytimz",
|
||||
"simon@simonmarcus.org": "simon-marcus",
|
||||
"xowiekk@gmail.com": "Xowiek",
|
||||
"1243352777@qq.com": "zons-zhaozhy",
|
||||
# ── bulk addition: 75 emails resolved via API, PR salvage bodies, noreply
|
||||
# crossref, and GH contributor list matching (April 2026 audit) ──
|
||||
|
|
|
|||
|
|
@ -144,6 +144,18 @@ class TestGatewayPersonalityNone:
|
|||
|
||||
assert "none" in result.lower()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_empty_personality_list_uses_profile_display_path(self, tmp_path):
|
||||
runner = self._make_runner(personalities={})
|
||||
(tmp_path / "config.yaml").write_text(yaml.dump({"agent": {"personalities": {}}}))
|
||||
|
||||
with patch("gateway.run._hermes_home", tmp_path), \
|
||||
patch("hermes_constants.display_hermes_home", return_value="~/.hermes/profiles/coder"):
|
||||
event = self._make_event("")
|
||||
result = await runner._handle_personality_command(event)
|
||||
|
||||
assert result == "No personalities configured in `~/.hermes/profiles/coder/config.yaml`"
|
||||
|
||||
|
||||
class TestPersonalityDictFormat:
|
||||
"""Test dict-format custom personalities with description, tone, style."""
|
||||
|
|
|
|||
|
|
@ -283,6 +283,19 @@ class TestBuildSessionContextPrompt:
|
|||
assert "Local" in prompt
|
||||
assert "machine running this agent" in prompt
|
||||
|
||||
def test_local_delivery_path_uses_display_hermes_home(self):
|
||||
config = GatewayConfig()
|
||||
source = SessionSource(
|
||||
platform=Platform.LOCAL, chat_id="cli",
|
||||
chat_name="CLI terminal", chat_type="dm",
|
||||
)
|
||||
ctx = build_session_context(source, config)
|
||||
|
||||
with patch("hermes_constants.display_hermes_home", return_value="~/.hermes/profiles/coder"):
|
||||
prompt = build_session_context_prompt(ctx)
|
||||
|
||||
assert "~/.hermes/profiles/coder/cron/output/" in prompt
|
||||
|
||||
def test_whatsapp_prompt(self):
|
||||
config = GatewayConfig(
|
||||
platforms={
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue