mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-10 12:18:44 +08:00
Compare commits
2 Commits
feat/debug
...
bb/version
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
237807ad3a | ||
|
|
d95c76aa37 |
@@ -15,6 +15,7 @@ describe('desktop slash command curation', () => {
|
||||
expect(isDesktopSlashSuggestion('/branch')).toBe(true)
|
||||
expect(isDesktopSlashSuggestion('/skin')).toBe(true)
|
||||
expect(isDesktopSlashSuggestion('/usage')).toBe(true)
|
||||
expect(isDesktopSlashSuggestion('/version')).toBe(true)
|
||||
expect(isDesktopSlashSuggestion('/yolo')).toBe(true)
|
||||
expect(isDesktopSlashCommand('/yolo')).toBe(true)
|
||||
})
|
||||
|
||||
@@ -43,6 +43,7 @@ const DESKTOP_COMMAND_META = [
|
||||
['/title', 'Rename the current session'],
|
||||
['/undo', 'Remove the last user/assistant exchange'],
|
||||
['/usage', 'Show token usage for this session'],
|
||||
['/version', 'Show Hermes Agent version'],
|
||||
['/yolo', 'Toggle YOLO — auto-approve dangerous commands']
|
||||
] as const
|
||||
|
||||
|
||||
4
cli.py
4
cli.py
@@ -9015,6 +9015,10 @@ class HermesCLI:
|
||||
elif canonical == "update":
|
||||
if self._handle_update_command():
|
||||
return False
|
||||
elif canonical == "version":
|
||||
from hermes_cli.main import _print_version_info
|
||||
|
||||
_print_version_info(check_updates=True)
|
||||
elif canonical == "paste":
|
||||
self._handle_paste_command()
|
||||
elif canonical == "image":
|
||||
|
||||
@@ -7932,6 +7932,8 @@ class GatewayRunner:
|
||||
return await self._handle_profile_command(event)
|
||||
if _cmd_def_inner.name == "update":
|
||||
return await self._handle_update_command(event)
|
||||
if _cmd_def_inner.name == "version":
|
||||
return await self._handle_version_command(event)
|
||||
|
||||
# Catch-all: any other recognized slash command reached the
|
||||
# running-agent guard. Reject gracefully rather than falling
|
||||
@@ -8288,6 +8290,9 @@ class GatewayRunner:
|
||||
if canonical == "update":
|
||||
return await self._handle_update_command(event)
|
||||
|
||||
if canonical == "version":
|
||||
return await self._handle_version_command(event)
|
||||
|
||||
if canonical == "debug":
|
||||
return await self._handle_debug_command(event)
|
||||
|
||||
@@ -10913,6 +10918,12 @@ class GatewayRunner:
|
||||
return event.platform_update_id <= recorded_uid
|
||||
|
||||
|
||||
async def _handle_version_command(self, event: MessageEvent) -> str:
|
||||
"""Handle /version — show the running Hermes Agent version."""
|
||||
from hermes_cli.banner import format_banner_version_label
|
||||
|
||||
return format_banner_version_label()
|
||||
|
||||
async def _handle_help_command(self, event: MessageEvent) -> str:
|
||||
"""Handle /help command - list available commands."""
|
||||
from hermes_cli.commands import gateway_help_lines
|
||||
|
||||
@@ -216,6 +216,7 @@ COMMAND_REGISTRY: list[CommandDef] = [
|
||||
CommandDef("image", "Attach a local image file for your next prompt", "Info",
|
||||
cli_only=True, args_hint="<path>"),
|
||||
CommandDef("update", "Update Hermes Agent to the latest version", "Info"),
|
||||
CommandDef("version", "Show Hermes Agent version", "Info", aliases=("v",)),
|
||||
CommandDef("debug", "Upload debug report (system info + logs) and get shareable links", "Info"),
|
||||
|
||||
# Exit
|
||||
@@ -349,6 +350,7 @@ ACTIVE_SESSION_BYPASS_COMMANDS: frozenset[str] = frozenset(
|
||||
"steer",
|
||||
"stop",
|
||||
"update",
|
||||
"version",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -6647,7 +6647,9 @@ def cmd_import(args):
|
||||
|
||||
|
||||
def _print_version_info(*, check_updates: bool = True) -> None:
|
||||
print(f"Hermes Agent v{__version__} ({__release_date__})")
|
||||
from hermes_cli.banner import format_banner_version_label
|
||||
|
||||
print(format_banner_version_label())
|
||||
print(f"Project: {PROJECT_ROOT}")
|
||||
|
||||
# Show Python version
|
||||
|
||||
28
tests/cli/test_version_command.py
Normal file
28
tests/cli/test_version_command.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Tests for the /version slash command."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from cli import HermesCLI
|
||||
from hermes_cli.commands import GATEWAY_KNOWN_COMMANDS, resolve_command
|
||||
|
||||
|
||||
def test_version_command_is_registered():
|
||||
cmd = resolve_command("version")
|
||||
assert cmd is not None
|
||||
assert cmd.name == "version"
|
||||
assert cmd.category == "Info"
|
||||
assert resolve_command("v") is cmd
|
||||
|
||||
|
||||
def test_version_is_gateway_known():
|
||||
assert "version" in GATEWAY_KNOWN_COMMANDS
|
||||
assert "v" in GATEWAY_KNOWN_COMMANDS
|
||||
|
||||
|
||||
def test_process_command_version_prints_version_info():
|
||||
cli_obj = HermesCLI.__new__(HermesCLI)
|
||||
|
||||
with patch("hermes_cli.main._print_version_info") as mock_print:
|
||||
assert cli_obj.process_command("/version") is True
|
||||
|
||||
mock_print.assert_called_once_with(check_updates=True)
|
||||
12
tests/gateway/test_version_command.py
Normal file
12
tests/gateway/test_version_command.py
Normal file
@@ -0,0 +1,12 @@
|
||||
"""Tests for gateway /version command."""
|
||||
|
||||
import asyncio
|
||||
|
||||
from hermes_cli.banner import format_banner_version_label
|
||||
|
||||
|
||||
def test_gateway_version_command_returns_release_line():
|
||||
from gateway.run import GatewayRunner
|
||||
|
||||
result = asyncio.run(GatewayRunner._handle_version_command(None, None)) # type: ignore[arg-type]
|
||||
assert result == format_banner_version_label()
|
||||
Reference in New Issue
Block a user