make bridge worker transport configurable (#1106)
This commit is contained in:
@@ -30,6 +30,13 @@ Override with:
|
||||
HERMES_AGENT_BRIDGE_ENDPOINT=tcp://127.0.0.1:8765 python packages/server/src/services/hermes/agent-bridge/hermes_bridge.py
|
||||
```
|
||||
|
||||
Profile workers use the same platform defaults: TCP on Windows and IPC on
|
||||
macOS/Linux. Override worker transport with:
|
||||
|
||||
```bash
|
||||
HERMES_AGENT_BRIDGE_WORKER_TRANSPORT=tcp HERMES_AGENT_BRIDGE_WORKER_PORT_BASE=18780 python packages/server/src/services/hermes/agent-bridge/hermes_bridge.py
|
||||
```
|
||||
|
||||
The service discovers Hermes Agent in this order:
|
||||
|
||||
1. `--agent-root`
|
||||
|
||||
@@ -2416,7 +2416,9 @@ class WorkerProcess:
|
||||
def _worker_endpoint(key: str, namespace: str | None = None) -> str:
|
||||
namespace_key = f"{namespace or ''}\0{key}"
|
||||
safe = hashlib.sha256(namespace_key.encode("utf-8")).hexdigest()[:16]
|
||||
if os.name == "nt":
|
||||
transport = os.environ.get("HERMES_AGENT_BRIDGE_WORKER_TRANSPORT", "").strip().lower()
|
||||
use_tcp = transport == "tcp" or (transport not in {"ipc", "unix"} and os.name == "nt")
|
||||
if use_tcp:
|
||||
port_base = int(os.environ.get("HERMES_AGENT_BRIDGE_WORKER_PORT_BASE", "18780"))
|
||||
return f"tcp://127.0.0.1:{port_base + int(safe[:4], 16) % 1000}"
|
||||
root = Path(tempfile.gettempdir()) / "hermes-agent-bridge-workers"
|
||||
|
||||
Reference in New Issue
Block a user