fix(ci): restore macos gateway uid helper

This commit is contained in:
晴天
2026-07-14 23:33:03 -07:00
parent 90df159d5e
commit 619d13b415
3 changed files with 28 additions and 1 deletions

View File

@@ -62,7 +62,7 @@
### 测试与验证 (Testing)
- Node.js `22.22.3``node --test tests/*.test.js`503 passed
- Node.js `22.22.3``node --test tests/*.test.js`504 passed
- Node.js `22.22.3``npm run build`:通过
- `cargo fmt --all -- --check`:通过
- `cargo check --locked`:通过

View File

@@ -6026,6 +6026,26 @@ pub fn delete_backup(name: String) -> Result<(), String> {
fs::remove_file(&path).map_err(|e| format!("删除失败: {e}"))
}
/// 获取当前用户 UID供 macOS launchctl 的 gui/<uid> 服务域使用。
#[allow(dead_code)]
fn get_uid() -> Result<u32, String> {
#[cfg(target_os = "windows")]
{
Ok(0)
}
#[cfg(not(target_os = "windows"))]
{
let output = Command::new("id")
.arg("-u")
.output()
.map_err(|e| format!("获取 UID 失败: {e}"))?;
String::from_utf8_lossy(&output.stdout)
.trim()
.parse::<u32>()
.map_err(|e| format!("解析 UID 失败: {e}"))
}
}
const OPENCLAW_NATIVE_CONFIG_RELOAD_VERSION_FLOOR: &str = "2026.7.1";
fn supports_native_config_reload(version: &str) -> bool {

View File

@@ -50,6 +50,13 @@ test('OpenClaw 7.1 发布与容器基线不低于 Node.js 22.22.3', () => {
assert.match(read('Dockerfile'), /FROM node:22\.22\.3-alpine AS production/)
})
test('macOS Gateway 服务操作保留 launchctl 所需的用户 UID helper', () => {
const config = read('src-tauri/src/commands/config.rs')
assert.match(config, /fn get_uid\(\) -> Result<u32, String>/)
assert.match(config, /Command::new\("id"\)[\s\S]*?\.arg\("-u"\)/)
assert.match(config, /format!\("gui\/\{uid\}\/ai\.openclaw\.gateway"\)/)
})
test('Hermes Rust 与 Web 关键 Provider 注册表保持一致', () => {
const rust = read('src-tauri/src/commands/hermes_providers.rs')
const web = read('scripts/dev-api.js')