feat: 灵犀 Studio Web UI 定制版
Build / build (push) Has been cancelled
NPM Lockfile Check / npm ci --ignore-scripts (push) Has been cancelled
Playwright / e2e (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yi
2026-06-05 11:29:11 +08:00
commit 7d10320a82
643 changed files with 164406 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
import { describe, expect, it } from 'vitest'
import { homedir } from 'os'
import { join, resolve } from 'path'
import { getListenHost, getWebUiHome, shouldCreateWebUiDataDir } from '../../packages/server/src/config'
describe('server config', () => {
it('defaults to an IPv4 bind host', () => {
expect(getListenHost({})).toBe('0.0.0.0')
})
it('uses BIND_HOST when provided', () => {
expect(getListenHost({ BIND_HOST: ' :: ' })).toBe('::')
})
it('ignores blank BIND_HOST values', () => {
expect(getListenHost({ BIND_HOST: ' ' })).toBe('0.0.0.0')
})
it('defaults web-ui home to ~/.hermes-web-ui', () => {
expect(getWebUiHome({})).toBe(join(homedir(), '.hermes-web-ui'))
})
it('uses HERMES_WEB_UI_HOME when provided', () => {
expect(getWebUiHome({ HERMES_WEB_UI_HOME: ' ./tmp/hermes-ui ' })).toBe(resolve('./tmp/hermes-ui'))
})
it('uses HERMES_WEBUI_STATE_DIR as a compatibility alias', () => {
expect(getWebUiHome({ HERMES_WEBUI_STATE_DIR: ' ./tmp/hermes-state ' })).toBe(resolve('./tmp/hermes-state'))
})
it('only creates the development data directory outside production', () => {
expect(shouldCreateWebUiDataDir({ NODE_ENV: 'development' })).toBe(true)
expect(shouldCreateWebUiDataDir({ NODE_ENV: 'production' })).toBe(false)
})
})