Skip to content

设备型号数据库(友好名称)

macOS 伴侣应用在 Instances 界面通过将 Apple 设备型号标识符(如 iPad16,6Mac16,6)映射为可读名称,来显示设备的友好名称。

该映射以 JSON 形式内置在以下路径:

  • apps/macos/Sources/OpenClaw/Resources/DeviceModels/

数据来源

当前映射来自以下 MIT 许可的开源仓库:

  • kyle-seongwoo-jun/apple-device-identifiers

为保证构建的确定性,JSON 文件固定到上游的特定 commit(记录在 apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md 中)。

更新数据库

  1. 选择要固定的上游 commit(iOS 和 macOS 各一个)。
  2. apps/macos/Sources/OpenClaw/Resources/DeviceModels/NOTICE.md 中更新 commit 哈希值。
  3. 重新下载 JSON 文件,固定到对应的 commit:
bash
IOS_COMMIT="<ios-device-identifiers.json 的 commit sha>"
MAC_COMMIT="<mac-device-identifiers.json 的 commit sha>"

curl -fsSL "https://raw.githubusercontent.com/kyle-seongwoo-jun/apple-device-identifiers/${IOS_COMMIT}/ios-device-identifiers.json" \
  -o apps/macos/Sources/OpenClaw/Resources/DeviceModels/ios-device-identifiers.json

curl -fsSL "https://raw.githubusercontent.com/kyle-seongwoo-jun/apple-device-identifiers/${MAC_COMMIT}/mac-device-identifiers.json" \
  -o apps/macos/Sources/OpenClaw/Resources/DeviceModels/mac-device-identifiers.json
  1. 确认 apps/macos/Sources/OpenClaw/Resources/DeviceModels/LICENSE.apple-device-identifiers.txt 与上游一致(如果上游许可证有变更,请同步替换)。
  2. 验证 macOS 应用能干净构建(无警告):
bash
swift build --package-path apps/macos