[codex] fix Windows desktop browser packaging (#1219)
* fix windows hermes home fallback * bundle Hermes desktop browser runtime * bundle desktop channel dependencies * avoid matrix e2ee build dependency * fix windows npm shim execution * fix bundled agent-browser chrome packaging * fix agent-browser chrome fallback copy * fix windows agent-browser home lookup * copy agent-browser chrome after install * fix browser output decoding on windows --------- Co-authored-by: xingzhi <chuzihao.czh@alibaba-inc.com>
This commit is contained in:
@@ -122,6 +122,15 @@ describe('agent bridge manager command resolution', () => {
|
||||
expect(DEFAULT_AGENT_BRIDGE_ENDPOINT).not.toBe('ipc:///tmp/hermes-agent-bridge.sock')
|
||||
})
|
||||
|
||||
it('honors the bridge connect retry environment override', async () => {
|
||||
process.env.HERMES_AGENT_BRIDGE_CONNECT_RETRY_MS = '120000'
|
||||
|
||||
const { AgentBridgeClient } = await import('../../packages/server/src/services/hermes/agent-bridge/client')
|
||||
const client = new AgentBridgeClient({ endpoint: 'tcp://127.0.0.1:1' })
|
||||
|
||||
expect(client.connectRetryMs).toBe(120000)
|
||||
})
|
||||
|
||||
it('waits briefly for a restarting bridge socket before failing', async () => {
|
||||
const endpoint = process.platform === 'win32'
|
||||
? `tcp://127.0.0.1:${32000 + (process.pid % 10000)}`
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { mkdirSync, mkdtempSync, rmSync } from 'fs'
|
||||
import { homedir, tmpdir } from 'os'
|
||||
import { join, resolve } from 'path'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { detectHermesHome } from '../../packages/server/src/services/hermes/hermes-path'
|
||||
|
||||
describe('Hermes path detection', () => {
|
||||
const originalEnv = { ...process.env }
|
||||
const originalPlatform = process.platform
|
||||
let tempDir = ''
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = mkdtempSync(join(tmpdir(), 'hermes-path-'))
|
||||
process.env = { ...originalEnv }
|
||||
delete process.env.HERMES_HOME
|
||||
delete process.env.LOCALAPPDATA
|
||||
delete process.env.APPDATA
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
Object.defineProperty(process, 'platform', { value: originalPlatform })
|
||||
process.env = { ...originalEnv }
|
||||
if (tempDir) rmSync(tempDir, { recursive: true, force: true })
|
||||
tempDir = ''
|
||||
})
|
||||
|
||||
it('keeps explicit HERMES_HOME even when the path does not exist', () => {
|
||||
process.env.HERMES_HOME = join(tempDir, 'custom-home')
|
||||
|
||||
expect(detectHermesHome()).toBe(resolve(tempDir, 'custom-home'))
|
||||
})
|
||||
|
||||
it('falls back to ~/.hermes on Windows when LOCALAPPDATA hermes is missing', () => {
|
||||
Object.defineProperty(process, 'platform', { value: 'win32' })
|
||||
process.env.LOCALAPPDATA = join(tempDir, 'Local')
|
||||
|
||||
expect(detectHermesHome()).toBe(resolve(homedir(), '.hermes'))
|
||||
})
|
||||
|
||||
it('uses existing Windows LOCALAPPDATA hermes before APPDATA', () => {
|
||||
Object.defineProperty(process, 'platform', { value: 'win32' })
|
||||
const localHermes = join(tempDir, 'Local', 'hermes')
|
||||
const roamingHermes = join(tempDir, 'Roaming', 'hermes')
|
||||
mkdirSync(localHermes, { recursive: true })
|
||||
mkdirSync(roamingHermes, { recursive: true })
|
||||
process.env.LOCALAPPDATA = join(tempDir, 'Local')
|
||||
process.env.APPDATA = join(tempDir, 'Roaming')
|
||||
|
||||
expect(detectHermesHome()).toBe(resolve(localHermes))
|
||||
})
|
||||
|
||||
it('falls back to existing Windows APPDATA hermes when LOCALAPPDATA hermes is missing', () => {
|
||||
Object.defineProperty(process, 'platform', { value: 'win32' })
|
||||
const roamingHermes = join(tempDir, 'Roaming', 'hermes')
|
||||
mkdirSync(roamingHermes, { recursive: true })
|
||||
process.env.LOCALAPPDATA = join(tempDir, 'Local')
|
||||
process.env.APPDATA = join(tempDir, 'Roaming')
|
||||
|
||||
expect(detectHermesHome()).toBe(resolve(roamingHermes))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user