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.
23 lines
801 B
TypeScript
23 lines
801 B
TypeScript
/** The connected process owns its runtime version, not a checkout on disk.
|
|
* `displayVersion` carries the distance past the release tag (`0.21.5+1913`);
|
|
* a backend that predates it only reports the bare release. */
|
|
export async function resolveGatewayVersion(request: (path: string) => Promise<unknown>): Promise<string> {
|
|
try {
|
|
const status: unknown = await request('/api/health')
|
|
|
|
if (status && typeof status === 'object') {
|
|
if ('displayVersion' in status && typeof status.displayVersion === 'string' && status.displayVersion) {
|
|
return status.displayVersion
|
|
}
|
|
|
|
if ('version' in status && typeof status.version === 'string') {
|
|
return status.version
|
|
}
|
|
}
|
|
} catch {
|
|
// An offline gateway has no known running version.
|
|
}
|
|
|
|
return ''
|
|
}
|