Import the client, server, skills, tests, and build scripts as the starting point for the rebuild, then trim the surfaces this project does not ship: Electron desktop packaging, the marketing website, and the ESP32 firmware tree. CI keeps the web build, e2e, lockfile, release, and Docker workflows. Rename the package and CLI entry points to hermes-ui, drop the prepare hook so npm ci no longer triggers a build, and drop the removed tsconfig and nodemon references. Rewrite AGENTS.md, ARCHITECTURE.md, DEVELOPMENT.md, and the READMEs so the documented package map and hard rules match this repository. reference_code/ is ignored: it is a read-only snapshot, not an input to the build.
99 lines
3.5 KiB
TypeScript
99 lines
3.5 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
describe('AgentBridgeClient.chat reasoning_effort forwarding', () => {
|
|
it('forwards reasoning_effort when provided in options', async () => {
|
|
const { AgentBridgeClient } = await import('../../packages/server/src/services/hermes/agent-bridge/client')
|
|
const client = new AgentBridgeClient({ endpoint: 'tcp://127.0.0.1:1', connectRetryMs: 0, timeoutMs: 1 })
|
|
const request = vi.spyOn(client, 'request').mockResolvedValue({
|
|
ok: true,
|
|
run_id: 'r-1',
|
|
session_id: 's-1',
|
|
status: 'running',
|
|
})
|
|
|
|
await client.chat('s-1', 'hello', undefined, undefined, 'default', {
|
|
reasoning_effort: 'low',
|
|
})
|
|
|
|
expect(request).toHaveBeenCalledWith(expect.objectContaining({
|
|
action: 'chat',
|
|
session_id: 's-1',
|
|
reasoning_effort: 'low',
|
|
}))
|
|
})
|
|
|
|
it('omits reasoning_effort entirely when the option is not set', async () => {
|
|
const { AgentBridgeClient } = await import('../../packages/server/src/services/hermes/agent-bridge/client')
|
|
const client = new AgentBridgeClient({ endpoint: 'tcp://127.0.0.1:1', connectRetryMs: 0, timeoutMs: 1 })
|
|
const request = vi.spyOn(client, 'request').mockResolvedValue({
|
|
ok: true,
|
|
run_id: 'r-2',
|
|
session_id: 's-2',
|
|
status: 'running',
|
|
})
|
|
|
|
await client.chat('s-2', 'hello')
|
|
|
|
const call = request.mock.calls[0]?.[0] as Record<string, unknown> | undefined
|
|
expect(call).toBeDefined()
|
|
expect(call).not.toHaveProperty('reasoning_effort')
|
|
})
|
|
|
|
it('omits reasoning_effort when option is an empty string', async () => {
|
|
const { AgentBridgeClient } = await import('../../packages/server/src/services/hermes/agent-bridge/client')
|
|
const client = new AgentBridgeClient({ endpoint: 'tcp://127.0.0.1:1', connectRetryMs: 0, timeoutMs: 1 })
|
|
const request = vi.spyOn(client, 'request').mockResolvedValue({
|
|
ok: true,
|
|
run_id: 'r-3',
|
|
session_id: 's-3',
|
|
status: 'running',
|
|
})
|
|
|
|
await client.chat('s-3', 'hello', undefined, undefined, undefined, {
|
|
reasoning_effort: '',
|
|
})
|
|
|
|
const call = request.mock.calls[0]?.[0] as Record<string, unknown> | undefined
|
|
expect(call).toBeDefined()
|
|
expect(call).not.toHaveProperty('reasoning_effort')
|
|
})
|
|
|
|
it('forwards workspace to chat and context estimate requests', async () => {
|
|
const { AgentBridgeClient } = await import('../../packages/server/src/services/hermes/agent-bridge/client')
|
|
const client = new AgentBridgeClient({ endpoint: 'tcp://127.0.0.1:1', connectRetryMs: 0, timeoutMs: 1 })
|
|
const request = vi.spyOn(client, 'request')
|
|
.mockResolvedValueOnce({
|
|
ok: true,
|
|
run_id: 'r-workspace',
|
|
session_id: 's-workspace',
|
|
status: 'running',
|
|
})
|
|
.mockResolvedValueOnce({
|
|
ok: true,
|
|
session_id: 's-workspace',
|
|
token_count: 0,
|
|
message_count: 0,
|
|
tool_count: 0,
|
|
system_prompt_chars: 0,
|
|
})
|
|
|
|
await client.chat('s-workspace', 'hello', undefined, undefined, 'default', {
|
|
workspace: 'C:\\Users\\tester\\workspace',
|
|
})
|
|
await client.contextEstimate('s-workspace', [], undefined, 'default', {
|
|
workspace: 'C:\\Users\\tester\\workspace',
|
|
})
|
|
|
|
expect(request.mock.calls[0]?.[0]).toEqual(expect.objectContaining({
|
|
action: 'chat',
|
|
session_id: 's-workspace',
|
|
workspace: 'C:\\Users\\tester\\workspace',
|
|
}))
|
|
expect(request.mock.calls[1]?.[0]).toEqual(expect.objectContaining({
|
|
action: 'context_estimate',
|
|
session_id: 's-workspace',
|
|
workspace: 'C:\\Users\\tester\\workspace',
|
|
}))
|
|
})
|
|
})
|