fix: group-chat agent client use dynamic port instead of hardcoded 8648 (#539)

The connect() method defaulted to port 8648, causing websocket connection
refused errors when the server was started with a custom port via
`hermes-web-ui start <port>` or PORT env var. Now reads from process.env.PORT.

Closes #536

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-05-08 14:04:51 +08:00
committed by GitHub
parent e55792acbb
commit 10d2f892ff
@@ -91,10 +91,11 @@ class AgentClient {
this.storage = storage
}
async connect(port = 8648): Promise<void> {
async connect(port?: number): Promise<void> {
const actualPort = port ?? parseInt(process.env.PORT || '8648', 10)
const token = await getToken()
this.socket = io(`http://127.0.0.1:${port}/group-chat`, {
this.socket = io(`http://127.0.0.1:${actualPort}/group-chat`, {
auth: {
token: token || undefined,
name: this.name,