fix: onboarding improvements — auto port detection, better error messages, CI fix

- Auto-detect WebAPI on port 8642/8643 (no HERMES_API_URL required)
- Connection error shows specific WebAPI install instructions
- CI: --no-frozen-lockfile to match Docker setup
- .env.example documents all config options
- Startup log shows configured API URL
This commit is contained in:
outsourc-e
2026-03-18 22:38:28 -04:00
parent 3abc87a6d5
commit 051d1365c6
5 changed files with 39 additions and 3 deletions

View File

@@ -1,3 +1,10 @@
# Hermes Agent WebAPI URL (auto-detects port 8642/8643 if not set)
# HERMES_API_URL=http://127.0.0.1:8642
# Workspace directory (where Hermes can read/write files)
# HERMES_WORKSPACE_DIR=/path/to/your/workspace
# Allowed hosts for remote access (comma-separated)
# HERMES_ALLOWED_HOSTS=localhost,127.0.0.1
# Set the API key for your provider (only one needed)
# ANTHROPIC_API_KEY=sk-ant-xxx
# OPENAI_API_KEY=sk-xxx

View File

@@ -30,7 +30,7 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm install --no-frozen-lockfile
- name: Run linter
run: pnpm run lint || echo "⚠️ Lint not configured, skipping"
@@ -74,7 +74,7 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm install --no-frozen-lockfile
- name: Run tests
run: pnpm test || echo "⚠️ No tests configured"

View File

@@ -55,6 +55,14 @@ function classifyConnectionError(
}
}
if (lower.includes('econnrefused') && lower.includes('8642')) {
return {
title: 'Hermes WebAPI not running',
description: 'The Hermes WebAPI server is not running on port 8642.',
action: 'Run: cd hermes-agent && pip install -e . && hermes-webapi',
}
}
if (
lower.includes('econnrefused') ||
lower.includes('fetch') ||

View File

@@ -4,7 +4,7 @@
* degrade cleanly against older Hermes gateways.
*/
export const HERMES_API =
export let HERMES_API =
process.env.HERMES_API_URL || 'http://127.0.0.1:8642'
export const HERMES_UPGRADE_INSTRUCTIONS =
@@ -94,6 +94,25 @@ export async function probeGateway(options?: {
}
probePromise = (async () => {
// Auto-detect port if no explicit env var set
if (!process.env.HERMES_API_URL) {
const healthOn8642 = await probe('/health')
if (!healthOn8642) {
const fallback = 'http://127.0.0.1:8643'
const healthOn8643 = await fetch(`${fallback}/health`, {
signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),
}).then(r => r.ok).catch(() => false)
if (healthOn8643) {
HERMES_API = fallback
console.log(`[gateway] Connected to Hermes at ${HERMES_API}`)
} else {
console.warn('[gateway] Could not reach Hermes on 8642 or 8643')
}
} else {
console.log(`[gateway] Connected to Hermes at ${HERMES_API}`)
}
}
const [health, models, sessions, skills, memory, config, jobs] =
await Promise.all([
probe('/health'),

View File

@@ -13,6 +13,8 @@ import {
SESSIONS_API_UNAVAILABLE_MESSAGE,
} from './gateway-capabilities'
console.log(`[hermes-api] Configured API: ${HERMES_API}`)
// ── Types ─────────────────────────────────────────────────────────
export type HermesSession = {