Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 59s
Cherry-pick the Hermes Web Console from gary-the-ai/hermes-web-console-gui. React + TypeScript frontend with Vite, Python aiohttp backend API. Components: - web_console/ — React frontend (chat, sessions, memory, settings, skills, gateway config, cron, workspace, tools, browser, insights pages) - gateway/web_console/ — Python backend API (23 endpoints, SSE event bus, 11 service modules) - gateway/platforms/api_server_ui.py — embedded browser UI for API server - gateway/platforms/api_server.py — route registration refactored into _register_routes(), web console mounted via maybe_register_web_console() - run-gui.sh / setup-gui.sh — one-command launch and setup scripts - tests/gateway/test_api_server_gui_mount.py — 4 integration tests (passing) - tests/web_console/ — 13 backend test files (51 passing) - docs/plans/ — implementation plan, API schema, frontend architecture Fix: added missing ModelContextError class and CRON_MIN_CONTEXT_TOKENS to cron/scheduler.py (pre-existing import bug). Closes #325
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""Command registry API routes for the Hermes Web Console backend."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from aiohttp import web
|
|
|
|
from hermes_cli.commands import COMMAND_REGISTRY
|
|
|
|
|
|
def _command_entry(command) -> dict[str, object]:
|
|
aliases = list(command.aliases)
|
|
names = [command.name, *aliases]
|
|
return {
|
|
"name": command.name,
|
|
"description": command.description,
|
|
"category": command.category,
|
|
"aliases": aliases,
|
|
"names": names,
|
|
"args_hint": command.args_hint,
|
|
"subcommands": list(command.subcommands),
|
|
"cli_only": command.cli_only,
|
|
"gateway_only": command.gateway_only,
|
|
"gateway_config_gate": command.gateway_config_gate,
|
|
}
|
|
|
|
|
|
async def handle_list_commands(request: web.Request) -> web.Response:
|
|
"""GET /api/gui/commands — expose the shared Hermes slash-command registry."""
|
|
commands = [_command_entry(command) for command in COMMAND_REGISTRY]
|
|
return web.json_response({"ok": True, "commands": commands})
|
|
|
|
|
|
def register_commands_api_routes(app: web.Application) -> None:
|
|
app.router.add_get("/api/gui/commands", handle_list_commands) |