Server-side: - New hermes-integration module (runtime.js + routes.js + tests) exposing GET /api/openchamber/hermes/status - Reports availability of agent-activity, session-steer, and plan-gate runtimes plus plan-gate default config - Wired into feature-routes-runtime.js alongside existing integrations UI: - New HermesIntegration.tsx collapsible panel in Integrations page - Connection status indicator (green/red dot) with 30s polling - Plan gate default toggle (persists via updateDesktopSettings + recordDeferredOpenCodeRestart) - Read-only status rows for activity stream, steer channel, plan gate - Server version and uptime display Settings: - hermesPlanGateDefault field in settings registry and useUIStore - Search index entry with keywords: hermes, agent, integration, etc. - i18n keys for all 12 locales (English text as fallback) Verification: - Server tests: 7/7 passed (runtime + routes) - UI tests: 4/4 passed (HermesIntegration.test.tsx) - Typecheck: clean (no new errors) - oxlint: clean on all new/modified files
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
import express from 'express';
|
|
import request from 'supertest';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
|
|
import { registerHermesIntegrationRoutes } from './routes.js';
|
|
|
|
const createApp = (getStatus) => {
|
|
const app = express();
|
|
registerHermesIntegrationRoutes(app, { getStatus });
|
|
return app;
|
|
};
|
|
|
|
describe('Hermes integration route', () => {
|
|
it('returns status JSON from the runtime', async () => {
|
|
const getStatus = vi.fn(async () => ({
|
|
ok: true,
|
|
server: { version: '1.23.0', uptimeMs: 5000 },
|
|
integrations: {
|
|
agentActivity: { available: true },
|
|
steer: { available: true },
|
|
planGate: { available: true },
|
|
},
|
|
config: {
|
|
planGateDefault: false,
|
|
activityRateLimitMs: 2000,
|
|
},
|
|
}));
|
|
const response = await request(createApp(getStatus))
|
|
.get('/api/openchamber/hermes/status')
|
|
.expect(200);
|
|
|
|
expect(response.body.ok).toBe(true);
|
|
expect(response.body.server.version).toBe('1.23.0');
|
|
expect(response.body.integrations.agentActivity.available).toBe(true);
|
|
expect(getStatus).toHaveBeenCalledOnce();
|
|
});
|
|
|
|
it('returns 500 on runtime failure', async () => {
|
|
const getStatus = vi.fn(async () => {
|
|
throw new Error('runtime exploded');
|
|
});
|
|
const response = await request(createApp(getStatus))
|
|
.get('/api/openchamber/hermes/status')
|
|
.expect(500);
|
|
|
|
expect(response.body.ok).toBe(false);
|
|
expect(response.body.error).toBe('runtime exploded');
|
|
});
|
|
});
|