[codex] add customizable profile avatars (#870)
* add customizable profile avatars * keep profile avatar visible when sidebar collapses * simplify collapsed profile avatar styling * force managed gateway startup in docker * limit gateway autostart to active profile * restore all profile gateway autostart * fix managed gateway runtime detection
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { mkdtempSync, rmSync, writeFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import {
|
||||
gatewayStatusLooksRuntimeLocked,
|
||||
gatewayStatusLooksRunning,
|
||||
gatewayStateLooksRunningForProfile,
|
||||
parseGatewayStatusesFromProfileListOutput,
|
||||
shouldUseManagedGatewayRun,
|
||||
shouldUseManagedGatewayRunForAutostart,
|
||||
} from '../../packages/server/src/services/hermes/gateway-autostart'
|
||||
|
||||
describe('gateway autostart status parsing', () => {
|
||||
@@ -35,4 +41,30 @@ describe('gateway autostart status parsing', () => {
|
||||
expect(gatewayStatusLooksRunning('stopped')).toBe(false)
|
||||
expect(gatewayStatusLooksRunning('not running')).toBe(false)
|
||||
})
|
||||
|
||||
it('allows managed gateway mode to be forced by environment', () => {
|
||||
const previous = process.env.HERMES_WEB_UI_MANAGED_GATEWAY
|
||||
process.env.HERMES_WEB_UI_MANAGED_GATEWAY = '1'
|
||||
try {
|
||||
expect(shouldUseManagedGatewayRun()).toBe(true)
|
||||
expect(shouldUseManagedGatewayRunForAutostart()).toBe(true)
|
||||
} finally {
|
||||
if (previous === undefined) delete process.env.HERMES_WEB_UI_MANAGED_GATEWAY
|
||||
else process.env.HERMES_WEB_UI_MANAGED_GATEWAY = previous
|
||||
}
|
||||
})
|
||||
|
||||
it('detects managed gateway state files with a live pid', () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'hermes-gateway-state-'))
|
||||
try {
|
||||
writeFileSync(
|
||||
join(dir, 'gateway_state.json'),
|
||||
JSON.stringify({ pid: process.pid, gateway_state: 'running' }),
|
||||
'utf-8',
|
||||
)
|
||||
expect(gatewayStateLooksRunningForProfile(dir)).toBe(true)
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user