Files
hermes-agent/plugins/google_meet/node/cli.py
Teknium a5bd246865 Old pre-decomposition import paths are gone: plugin compat layer removed on schedule (#126164)
* refactor(plugins): remove the Sep 2026 decomposition compat layer on schedule

The PLUGIN-COMPAT layer (2776813df3 + d63e380324 + 0a5164cebe) kept pre-#102117 import paths
alive for external plugins until 2026-09-14. That window closed two weeks ago; since then the loader
has already been skipping plugins that use the old paths. This removes the layer itself:

- 328 appended `PLUGIN-COMPAT` blocks (lazy `__getattr__` pointer tables, re-exported third-party
  names, restored dead definitions) and the three re-export stub modules
  (gateway/startup_watchdog, hermes_cli/observability/relay_runtime, tools/environments/modal_utils)
- COMPAT_MANIFEST.md, compat_manifest.json, scripts/check_compat_pointers.py and its lint step
- the reporting surfaces: CLI banner notice, `hermes plugins compat`, the `hermes doctor` section,
  the post-update notice, the Desktop one-time dialog, the loader's pre-import skip and the
  `plugins.allow_deprecated_imports` escape hatch

An external plugin that still imports an old path now fails to load with its ImportError as the
reason in `hermes plugins list`, the same path as any broken plugin.

hermes_cli/plugin_compat.py stays as three inert stubs (compat_report, removal_in_effect,
summary_lines): an already-running pre-removal `hermes update` lazy-imports them after the checkout
swap (tests/compat/old_updater_surface.json).

In-tree fallout, both already dead: hermes_cli/setup.py::_check_espeak_ng (no callers; its
`shutil` came from a compat block) and gateway/config.py::SessionResetPolicy ("retained solely for
the scheduled plugin-compat window"). Two test_run_agent patches targeted the removed
`run_agent.handle_function_call` pointer; they now patch `model_tools.handle_function_call`, the
seam production reads, like every sibling test in that file.

* chore: retrigger CI (zero-job startup_failure phantom)

* test: drop resolution allowlist rows for the two deleted which() sites

hermes_cli/setup.py::_check_espeak_ng (dead) and tools/skillevaluator_scan.py::scanner_available
(a restored definition inside a PLUGIN-COMPAT block) no longer exist; the stale-row gate requires
their allowlist entries go with them.
2026-09-28 10:21:41 -07:00

103 lines
3.7 KiB
Python

"""`hermes meet node ...` subcommand tree, wired under the ``hermes meet`` parser."""
from __future__ import annotations
import argparse
import asyncio
import json
import sys
from plugins.google_meet.node.client import NodeClient
from plugins.google_meet.node.registry import NodeRegistry
from plugins.google_meet.node.server import NodeServer
def register_cli(subparser: argparse.ArgumentParser) -> None:
"""Add ``run / list / approve / remove / status / ping`` subparsers to the ``node`` parser."""
sp = subparser.add_subparsers(dest="node_cmd", required=True)
run = sp.add_parser("run", help="Start a node server on this machine.")
run.add_argument("--host", default="0.0.0.0")
run.add_argument("--port", type=int, default=18789)
run.add_argument("--display-name", default="hermes-meet-node")
sp.add_parser("list", help="List approved remote nodes.")
app = sp.add_parser("approve", help="Register a remote node on the gateway.")
for arg in ("name", "url", "token"):
app.add_argument(arg)
for name, help_ in (("remove", "Forget a registered node."), ("status", "Ping a registered node."),
("ping", "Alias for status.")):
sp.add_parser(name, help=help_).add_argument("name")
for p in sp.choices.values():
p.set_defaults(func=node_command)
def _cmd_run(args: argparse.Namespace, reg: NodeRegistry) -> int:
server = NodeServer(host=args.host, port=args.port, display_name=args.display_name)
token = server.ensure_token()
print(f"[meet-node] display_name={server.display_name}\n"
f"[meet-node] listening on ws://{args.host}:{args.port}\n"
f"[meet-node] token (copy to gateway): {token}\n[meet-node] approve with:\n"
f" hermes meet node approve <name> ws://<host>:{args.port} {token}")
try:
asyncio.run(server.serve())
except KeyboardInterrupt:
pass
except RuntimeError as exc:
print(f"[meet-node] error: {exc}", file=sys.stderr)
return 2
return 0
def _cmd_list(args: argparse.Namespace, reg: NodeRegistry) -> int:
nodes = reg.list_all()
if not nodes:
print("no nodes registered")
for n in nodes:
print(f"{n['name']}\t{n['url']}\ttoken={n['token'][:6]}…")
return 0
def _cmd_approve(args: argparse.Namespace, reg: NodeRegistry) -> int:
reg.add(args.name, args.url, args.token)
print(f"approved node {args.name!r} at {args.url}")
return 0
def _cmd_remove(args: argparse.Namespace, reg: NodeRegistry) -> int:
ok = reg.remove(args.name)
print(f"removed {args.name!r}" if ok else f"no such node: {args.name!r}")
return 0 if ok else 1
def _cmd_ping(args: argparse.Namespace, reg: NodeRegistry) -> int:
entry = reg.get(args.name)
if entry is None:
print(f"no such node: {args.name!r}", file=sys.stderr)
return 1
try:
result = NodeClient(entry["url"], entry["token"]).ping()
except Exception as exc: # noqa: BLE001 — surface any connection error
print(json.dumps({"ok": False, "error": str(exc)}))
return 1
print(json.dumps({"ok": True, "node": args.name, **result}))
return 0
_COMMANDS = {
"run": _cmd_run,
"list": _cmd_list,
"approve": _cmd_approve,
"remove": _cmd_remove,
"status": _cmd_ping,
"ping": _cmd_ping}
def node_command(args: argparse.Namespace) -> int:
"""Dispatch for ``hermes meet node ...``; returns a process exit code."""
cmd = getattr(args, "node_cmd", None)
handler = _COMMANDS.get(cmd or "")
if handler is None:
print(f"unknown node command: {cmd!r}", file=sys.stderr)
return 2
# ``run`` never touches the registry; constructing it is side-effect free.
return handler(args, NodeRegistry())