mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-14 04:02:26 +00:00
feat(gateway): add hermes gateway list to show all profiles' gateway status
Add a new `hermes gateway list` subcommand that shows the running
status of gateways across all profiles in a single view:
Gateways:
✓ default (current) — PID 155469
✓ wx1 — PID 166893
✗ dev — not running
Also includes `_print_other_profiles_gateway_status()` which appends
an "Other profiles" section to `hermes gateway status` output when
other profile gateways are running.
Both use existing `list_profiles()` and `find_profile_gateway_processes()`
— no new dependencies.
Closes #19127
Related: #19113, #4402, #4587
This commit is contained in:
parent
61d9e3366d
commit
3c439ec681
2 changed files with 46 additions and 0 deletions
|
|
@ -830,6 +830,46 @@ def _print_other_profiles_gateway_status() -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def _gateway_list() -> None:
|
||||||
|
"""List all profiles and their gateway running status.
|
||||||
|
|
||||||
|
Provides a single-command overview of every known profile and whether
|
||||||
|
its gateway is currently running, so multi-profile users don't have to
|
||||||
|
check each profile individually.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
from hermes_cli.profiles import list_profiles, get_active_profile_name
|
||||||
|
except Exception:
|
||||||
|
print("Unable to list profiles.")
|
||||||
|
return
|
||||||
|
|
||||||
|
profiles = list_profiles()
|
||||||
|
if not profiles:
|
||||||
|
print("No profiles found.")
|
||||||
|
return
|
||||||
|
|
||||||
|
current = get_active_profile_name()
|
||||||
|
|
||||||
|
print("Gateways:")
|
||||||
|
for prof in profiles:
|
||||||
|
marker = "✓" if prof.gateway_running else "✗"
|
||||||
|
label = prof.name
|
||||||
|
if prof.name == current:
|
||||||
|
label += " (current)"
|
||||||
|
parts = [f" {marker} {label:<24s}"]
|
||||||
|
if prof.gateway_running:
|
||||||
|
try:
|
||||||
|
from gateway.status import get_running_pid
|
||||||
|
pid = get_running_pid(prof.path / "gateway.pid", cleanup_stale=False)
|
||||||
|
if pid:
|
||||||
|
parts.append(f"PID {pid}")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
parts.append("not running")
|
||||||
|
print(" — ".join(parts))
|
||||||
|
|
||||||
|
|
||||||
def kill_gateway_processes(force: bool = False, exclude_pids: set | None = None,
|
def kill_gateway_processes(force: bool = False, exclude_pids: set | None = None,
|
||||||
all_profiles: bool = False) -> int:
|
all_profiles: bool = False) -> int:
|
||||||
"""Kill any running gateway processes. Returns count killed.
|
"""Kill any running gateway processes. Returns count killed.
|
||||||
|
|
@ -4798,6 +4838,9 @@ def _gateway_command_inner(args):
|
||||||
# Show other profiles' gateway status for multi-profile awareness
|
# Show other profiles' gateway status for multi-profile awareness
|
||||||
_print_other_profiles_gateway_status()
|
_print_other_profiles_gateway_status()
|
||||||
|
|
||||||
|
elif subcmd == "list":
|
||||||
|
_gateway_list()
|
||||||
|
|
||||||
elif subcmd == "migrate-legacy":
|
elif subcmd == "migrate-legacy":
|
||||||
# Stop, disable, and remove legacy Hermes gateway unit files from
|
# Stop, disable, and remove legacy Hermes gateway unit files from
|
||||||
# pre-rename installs (e.g. hermes.service). Profile units and
|
# pre-rename installs (e.g. hermes.service). Profile units and
|
||||||
|
|
|
||||||
|
|
@ -8690,6 +8690,9 @@ def main():
|
||||||
help="Target the Linux system-level gateway service",
|
help="Target the Linux system-level gateway service",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# gateway list
|
||||||
|
gateway_subparsers.add_parser("list", help="List all profiles and their gateway status")
|
||||||
|
|
||||||
# gateway setup
|
# gateway setup
|
||||||
gateway_subparsers.add_parser("setup", help="Configure messaging platforms")
|
gateway_subparsers.add_parser("setup", help="Configure messaging platforms")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue