mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-16 19:36:54 +00:00
About showed a bare "v0.21.5" for a checkout 1913 commits past the tag (`hermes --version`: "v0.21.5+1913.gf83a9e9"), because /api/health only reports the base release; the statusbar showed the version plus the exact commit beside it. VersionInfo.display_version is the short `<release>+<distance>` form and /api/health carries it as displayVersion (older backends fall back to the bare release). One renderer formatter, shortVersion, turns any version into that form, and About, the updates overlay, the statusbar and the command palette all label through it: "v0.21.5+1913". The full commit stays in the statusbar tooltip and the expanded version details.
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
|
|
import { test } from 'vitest'
|
|
|
|
import { resolveGatewayVersion } from './gateway-version'
|
|
|
|
test('version follows each supplied gateway response without caching', async (): Promise<void> => {
|
|
let version: string = '1.2.3'
|
|
|
|
const request: (endpoint: string) => Promise<{ version: string }> = async (
|
|
endpoint: string
|
|
): Promise<{ version: string }> => {
|
|
assert.equal(endpoint, '/api/health')
|
|
|
|
return { version }
|
|
}
|
|
|
|
assert.equal(await resolveGatewayVersion(request), '1.2.3')
|
|
version = '4.5.6'
|
|
assert.equal(await resolveGatewayVersion(request), '4.5.6')
|
|
})
|
|
|
|
test('unavailable gateway version stays unknown instead of using another install', async () => {
|
|
for (const response of [null, {}, { version: 42 }, { version: '' }]) {
|
|
assert.equal(await resolveGatewayVersion(async () => response), '')
|
|
}
|
|
|
|
assert.equal(
|
|
await resolveGatewayVersion(async () => {
|
|
throw new Error('offline')
|
|
}),
|
|
''
|
|
)
|
|
})
|
|
|
|
test('the distance past the release tag wins over the bare release', async (): Promise<void> => {
|
|
const ahead: { version: string; displayVersion: string } = { version: '0.21.5', displayVersion: '0.21.5+1913' }
|
|
assert.equal(await resolveGatewayVersion(async () => ahead), '0.21.5+1913')
|
|
assert.equal(await resolveGatewayVersion(async () => ({ ...ahead, displayVersion: '' })), '0.21.5')
|
|
})
|