[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:
ekko
2026-06-01 21:35:26 +08:00
committed by GitHub
parent 90929d0bfb
commit c27a12f56c
9 changed files with 668 additions and 50 deletions
@@ -23,6 +23,7 @@ function appendPinoContext(message: string, obj: any): string {
parts.push(`profile=${obj.profile}`)
}
if (obj.request?.action) parts.push(`action=${obj.request.action}`)
if (obj.err?.message) parts.push(`error=${obj.err.message}`)
if (obj.sessionId) parts.push(`session=${obj.sessionId}`)
if (obj.runId) parts.push(`run=${obj.runId}`)
if (obj.status) parts.push(`status=${obj.status}`)
@@ -2,11 +2,12 @@
* Hermes 路径检测工具 - 跨平台兼容
*
* Hermes 数据目录在不同平台上的位置:
* - Windows 原生安装: %LOCALAPPDATA%\hermes
* - Windows 原生安装: %LOCALAPPDATA%\hermes when it exists
* - Linux/macOS/WSL2: ~/.hermes
* - 用户自定义: HERMES_HOME 环境变量
*/
import { existsSync } from 'fs'
import { basename, dirname, isAbsolute, relative, resolve, join } from 'path'
import { homedir } from 'os'
@@ -15,7 +16,7 @@ import { homedir } from 'os'
*
* 检测优先级:
* 1. HERMES_HOME 环境变量(用户自定义)
* 2. Windows: %LOCALAPPDATA%\hermes(原生安装)
* 2. Windows: existing %LOCALAPPDATA%\hermes or %APPDATA%\hermes
* 3. 默认: ~/.hermesLinux/macOS/WSL2
*
* @returns Hermes 数据目录的绝对路径
@@ -26,16 +27,25 @@ export function detectHermesHome(): string {
return resolve(process.env.HERMES_HOME)
}
// 2. Windows:直接使用 %LOCALAPPDATA%\hermes
const defaultHome = resolve(homedir(), '.hermes')
// 2. Windows:优先使用存在的原生安装数据目录;不存在时回退到 ~/.hermes。
if (process.platform === 'win32') {
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA
if (localAppData) {
return join(localAppData, 'hermes')
const candidates = [
process.env.LOCALAPPDATA,
process.env.APPDATA,
]
.map(value => value?.trim())
.filter((value): value is string => !!value)
.map(value => resolve(value, 'hermes'))
for (const candidate of candidates) {
if (existsSync(candidate)) return candidate
}
}
// 3. Linux/macOS~/.hermes
return resolve(homedir(), '.hermes')
return defaultHome
}
/**