feat: status command (relay+client sync), remove version from banner

This commit is contained in:
Helios Agent 2026-03-03 16:55:11 +01:00
parent d114c813fb
commit 6643a33570
No known key found for this signature in database
GPG key ID: C8259547CD8309B5
2 changed files with 32 additions and 1 deletions

View file

@ -33,7 +33,7 @@ fn trunc(s: &str, max_chars: usize) -> String {
fn banner() {
println!();
println!(" {} HELIOS REMOTE v{} ({})", "".yellow().bold(), env!("CARGO_PKG_VERSION"), env!("GIT_COMMIT"));
println!(" {} HELIOS REMOTE ({})", "".yellow().bold(), env!("GIT_COMMIT"));
#[cfg(windows)]
{
let admin = is_admin();

View file

@ -253,6 +253,33 @@ def cmd_screenshot_window(args):
return out_path
def cmd_status(args):
"""Show relay, server, and client version/commit in one call."""
import requests as _requests
# 1. Relay (public endpoint, no auth)
try:
r = _requests.get(f"{BASE_URL}/version", timeout=10)
relay = r.json() if r.ok else {"commit": f"HTTP {r.status_code}"}
except Exception as e:
relay = {"commit": str(e)}
# 2. Client (via session)
sid = resolve_session(args.session_id)
try:
r2 = _req("GET", f"/sessions/{sid}/version")
client = r2.json()
except Exception as e:
client = {"commit": str(e)}
relay_commit = relay.get("commit", "?")
client_commit = client.get("commit", "?")
in_sync = "" if relay_commit == client_commit else "⚠️ "
print(f" relay {relay_commit}")
print(f" client {client_commit}")
print(f" {in_sync} {'in sync' if relay_commit == client_commit else 'OUT OF SYNC — client needs update'}")
def cmd_server_version(_args):
"""Get server version (no auth required)."""
import requests as _requests
@ -437,6 +464,9 @@ def build_parser() -> argparse.ArgumentParser:
xp.add_argument("session_id")
xp.add_argument("window_id", type=int)
stp = sub.add_parser("status", help="Show relay + client commit and sync status")
stp.add_argument("session_id")
sub.add_parser("server-version", help="Get server version (no auth required)")
vp = sub.add_parser("version", help="Get client version for a session")
@ -502,6 +532,7 @@ def main():
"version": cmd_version,
"upload": cmd_upload,
"download": cmd_download,
"status": cmd_status,
"screenshot-window": cmd_screenshot_window,
"find-window": cmd_find_window,
"wait-for-window": cmd_wait_for_window,