fix Windows desktop startup readiness (#1167)

* fix desktop startup readiness on windows

* add manual desktop build workflow

* hide Windows desktop server process window

* hide Windows Python bridge worker windows

* use no-window Python for Windows desktop CLI calls

---------

Co-authored-by: xingzhi <chuzihao.czh@alibaba-inc.com>
This commit is contained in:
sir1st
2026-05-31 09:17:49 +08:00
committed by GitHub
parent c998a53566
commit 96bdf8d1af
8 changed files with 276 additions and 29 deletions
+4
View File
@@ -66,6 +66,10 @@ describe('gateway autostart status parsing', () => {
}
})
it('uses managed gateway autostart on Windows', () => {
expect(shouldUseManagedGatewayRunForAutostart('win32')).toBe(true)
})
it('detects managed gateway state files with a live pid', () => {
const dir = mkdtempSync(join(tmpdir(), 'hermes-gateway-state-'))
try {
+7 -5
View File
@@ -22,6 +22,7 @@ function setPlatform(platform: NodeJS.Platform): void {
afterEach(() => {
execFileCalls.length = 0
delete process.env.HERMES_AGENT_BRIDGE_PYTHON
delete process.env.HERMES_AGENT_CLI_PYTHON
if (originalPlatform) Object.defineProperty(process, 'platform', originalPlatform)
vi.resetModules()
})
@@ -29,7 +30,7 @@ afterEach(() => {
describe('Hermes process invocation', () => {
it('bypasses the uv hermes.exe trampoline on Windows packaged installs', async () => {
setPlatform('win32')
process.env.HERMES_AGENT_BRIDGE_PYTHON = 'C:\\Users\\me\\AppData\\Local\\Programs\\Hermes Studio\\resources\\python\\python.exe'
process.env.HERMES_AGENT_CLI_PYTHON = 'C:\\Users\\me\\AppData\\Local\\Programs\\Hermes Studio\\resources\\python\\pythonw.exe'
const { execHermesWithBin } = await import('../../packages/server/src/services/hermes/hermes-process')
const result = await execHermesWithBin(
@@ -40,25 +41,26 @@ describe('Hermes process invocation', () => {
expect(result.stdout).toBe('ok\n')
expect(execFileCalls[0]).toMatchObject({
command: process.env.HERMES_AGENT_BRIDGE_PYTHON,
command: process.env.HERMES_AGENT_CLI_PYTHON,
args: ['-m', 'hermes_cli.main', 'kanban', '--board', 'default', 'create', 'demo', '--json'],
})
})
it('discovers sibling python.exe for a Windows hermes.exe launcher', async () => {
it('prefers sibling pythonw.exe for a Windows hermes.exe launcher', async () => {
setPlatform('win32')
const root = mkdtempSync(join(tmpdir(), 'hermes-process-'))
const root = mkdtempSync(join(tmpdir(), 'hermes-process-'))
try {
const scripts = join(root, 'Scripts')
mkdirSync(scripts)
writeFileSync(join(root, 'python.exe'), '')
writeFileSync(join(root, 'pythonw.exe'), '')
writeFileSync(join(scripts, 'hermes.exe'), '')
const { execHermesWithBin } = await import('../../packages/server/src/services/hermes/hermes-process')
await execHermesWithBin(join(scripts, 'hermes.exe'), ['--version'], { windowsHide: true })
expect(execFileCalls[0]).toMatchObject({
command: join(root, 'python.exe'),
command: join(root, 'pythonw.exe'),
args: ['-m', 'hermes_cli.main', '--version'],
})
} finally {