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:
@@ -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
|
||||
|
||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -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"
|
||||
|
||||
@@ -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') ||
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
SESSIONS_API_UNAVAILABLE_MESSAGE,
|
||||
} from './gateway-capabilities'
|
||||
|
||||
console.log(`[hermes-api] Configured API: ${HERMES_API}`)
|
||||
|
||||
// ── Types ─────────────────────────────────────────────────────────
|
||||
|
||||
export type HermesSession = {
|
||||
|
||||
Reference in New Issue
Block a user