Files
hermes-ui/tests/server/api-docs-controller.test.ts
T
toor 8c1ddf415f Phase 003: remove the coding-agent and ekko-agent runtimes
Every chat session now runs through the Hermes bridge, so the three chat
chains become feature-equivalent instead of three partially-maintained
dispatch paths. Keeping the coding-agent and in-house agent runtimes alive
meant every bridge change had to be mirrored into two more runtimes that
had already drifted.

Historical rows are read, not migrated: sessions stored with the retired
source normalize to cli on load, workflow graphs naming the retired agents
keep loading and run on the bridge, and the visible-source check plus
SOURCE_LABELS still recognize the old value so those sessions stay listed.

The public surface follows the code: the OpenAPI generator and the MCP
chat-run tool schema drop the six retired entry fields so external callers
are not told about runtimes that no longer exist.

harness-check gains a RETIRED_RUNTIME scan so the residual check is a
mechanical gate instead of a manual grep, with the two surviving read-side
compat sites recorded with reasons.

Refs: docs/phases/phase_003.md
2026-10-16 13:27:50 +08:00

36 lines
1.4 KiB
TypeScript

import { describe, expect, it, vi } from 'vitest'
import { openapi } from '../../packages/server/src/controllers/api-docs'
describe('api docs controller', () => {
it('returns the OpenAPI route catalog', async () => {
const ctx = {
set: vi.fn(),
status: 200,
body: undefined as any,
}
await openapi(ctx as any)
expect(ctx.set).toHaveBeenCalledWith('Cache-Control', 'no-store')
expect(ctx.body.openapi).toBe('3.0.3')
expect(ctx.body.paths['/api/openapi.json']).toBeTruthy()
expect(ctx.body.paths['/api/auth/login'].post.requestBody.content['application/json'].schema.required).toEqual([
'password',
'username',
])
expect(ctx.body.paths['/api/auth/users/{id}'].put.parameters).toEqual([
expect.objectContaining({ name: 'id', in: 'path', required: true }),
])
expect(ctx.body.paths['/api/hermes/kanban/search-sessions'].get.parameters).toEqual(
expect.arrayContaining([
expect.objectContaining({ name: 'task_id', in: 'query', required: true }),
expect.objectContaining({ name: 'profile', in: 'query', required: true }),
expect.objectContaining({ name: 'q', in: 'query', required: false }),
]),
)
expect(
ctx.body.paths['/api/chat-run/runs'].post.requestBody.content['application/json'].schema.properties.source.enum,
).toEqual(['cli', 'global_agent', 'workflow'])
})
})