The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
docs(plugins): document plugin socket auth, its retry contract and two gate notes
unsupportedpastelse35a654f448a
diff --git a/hermes_cli/web_server.py b/hermes_cli/web_server.pyindex 7f6dcbb07e3..c332feef5e5 100644--- a/hermes_cli/web_server.py+++ b/hermes_cli/web_server.py@@ -395,6 +395,10 @@ async def host_header_middleware(request: Request, call_next):return await call_next(request)+# Imported here, beside the plugin gates that use it, like the other mid-module web_server_*+# groups. Not an import cycle: web_server_dashboard reaches back into this module only inside+# functions, so the position is not load-bearing. What is load-bearing is the middleware+# registration order below (the HTTP gate before the auth middlewares, so it runs after them).from hermes_cli.web_server_dashboard import (PluginApiWebSocketGate, _plugin_api_name, _plugin_api_request_refused,)diff --git a/hermes_cli/web_server_chat.py b/hermes_cli/web_server_chat.pyindex b58e75af7c3..b614133ae75 100644--- a/hermes_cli/web_server_chat.py+++ b/hermes_cli/web_server_chat.py@@ -216,6 +216,10 @@ def _ws_auth_reason(ws: WebSocket) -> tuple[Optional[str], str]:Either mode: a local Desktop (no static token) presents the private one-use``X-Hermes-Gateway-Ticket`` grant its REST calls use (``authenticate_native_ws``).+ A socket that sends that header is judged by it alone: on a core socket+ (``/api/ws``, ``/api/pty``, the audio streams) the grant is refused+ (``native_invalid``) even when a valid ``token`` query credential rides along.+ That is intended; only the plugin WebSocket gate accepts the grant."""from hermes_cli.dashboard_auth.native_http import HEADER, authenticate_native_wsfrom hermes_cli.web_server import _SESSION_TOKEN, appdiff --git a/website/docs/developer-guide/desktop-plugin-sdk.md b/website/docs/developer-guide/desktop-plugin-sdk.mdindex 867cd223c5d..baaefe3e9da 100644--- a/website/docs/developer-guide/desktop-plugin-sdk.md+++ b/website/docs/developer-guide/desktop-plugin-sdk.md@@ -1873,6 +1873,28 @@ on OAuth remotes** (single-use WS tickets are core-managed) — treat the socketan accelerator over polling, never a replacement. Every consumer needs a pollingfallback anyway, since any socket can drop.+How it authenticates depends on the backend: a token-mode remote gets the same+`?token=` query credential the app's own sockets use; a **local gateway** (no+static token) authenticates with the native grant your `ctx.rest` calls carry.+Desktop's main process mints it for the active profile and attaches it as a+header to that one dial, so it never appears in a URL your code sees. The grant+is bound to your plugin's namespace and that profile; the gateway refuses the+upgrade if the plugin is disabled for the profile or for the gateway's launch+profile.++When the socket gives up (your polling fallback is then the only feed):++- **Keeps retrying**, with jittered backoff capped at 30 s, while dials fail to+ open. The client can't tell a refused upgrade from a gateway that is+ restarting, draining or being re-ensured, so a gateway restart of any length+ reconnects on its own.+- **Stops after 5 in a row** of refusals that don't clear by themselves: Desktop+ refusing to mint the grant for a permission reason (an unsafe gateway control+ path or profile home), or your backend accepting the socket and closing it at+ once. A socket that stays open resets the count.+- **Starts again** when the active connection or profile changes, with a fresh+ count, or when the view remounts.+For gateway-wide data (not your own namespace), use `host.request` (JSON-RPC) and`host.onEvent` (the gateway event stream) instead.