Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

fix(release): bundle signed universal Locked Use components

ifuryst0e90f55e5811
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ccb6a2e..793830f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -112,6 +112,8 @@ jobs:
} >> "${GITHUB_ENV}"
- name: Build npm release artifacts
+ env:
+ OPEN_COMPUTER_USE_INCLUDE_LOCKED_USE: "1"
run: npm run npm:pack
- name: Notarize direct-download Open Computer Use app
diff --git a/docs/exec-plans/active/20261014-v1.1.0-release.md b/docs/exec-plans/active/20261014-v1.1.0-release.md
new file mode 100644
index 0000000..167843e
--- /dev/null
+++ b/docs/exec-plans/active/20261014-v1.1.0-release.md
@@ -0,0 +1,20 @@
+# v1.1.0 release
+
+## 目标
+
+从合并后的 main 发布 v1.1.0,npm 与直接下载的签名 universal App 均包含可正常 enable 的 Locked Use 组件,版本与 Release notes 一致。
+
+## 范围与约束
+
+- 补齐组件 universal 构建、发布嵌入和制品检查,不改变已实测的解锁 / 遮罩逻辑。
+- 发布准备与版本 bump 分开提交;先本地验证,再推 main 和 v1.1.0 tag。
+- 检查 workflow、npm 三个包版本、GitHub assets / notes、校验和与签名。
+- 不更改其他会话 checkout,不在发版构建期间修改当前机器的认证规则或再次锁屏。
+
+## 进度
+
+- [x] PR #92 已合并,当前任务 checkout 切至最新 main。
+- [ ] universal 组件与发布包嵌入。
+- [ ] 本地测试、包版本 / 架构 / 签名与 notes 检查。
+- [ ] 发布准备与版本 bump 提交。
+- [ ] 推 main 与 tag,确认 workflow / npm / GitHub Release。
diff --git a/docs/histories/2026-10/20261014-0950-v1.1.0-release.md b/docs/histories/2026-10/20261014-0950-v1.1.0-release.md
new file mode 100644
index 0000000..fd6380d
--- /dev/null
+++ b/docs/histories/2026-10/20261014-0950-v1.1.0-release.md
@@ -0,0 +1,24 @@
+# v1.1.0 发布
+
+## 用户诉求
+
+PR #92 合并后,从 main 发布 v1.1.0。
+
+## 发布准备
+
+- 当前任务 checkout 切至合并后的 main,保留其他会话 checkout。
+- 补齐 Locked Use native / arm64 / x86_64 / universal 组件构建,按同一签名 team 嵌入主 App。正式签名构建默认包含组件;CI 强制嵌入,缺少签名时拒绝不完整发布。
+- 新增只读 bundle 检查:四个运行组件、架构与主 App 一致、签名 ID / team、严格嵌套签名;npm staging 与直接下载归档均执行检查。组件 plist 版本读取公共 manifest,避免继续发布开发占位版本。
+- 同步发布指南与中英文使用说明。准备与版本 bump 分开提交。
+
+## 本地验证
+
+- Swift 327 项(7 个 opt-in / live 跳过,0 失败),Node 36 项,Locked Use Python 30 项,三个 Go module 回归通过。
+- Developer ID universal App 与四个组件构建 / 签名 / 架构检查通过;remote 插件 ABI 与 native task-verifier 正负例通过。
+- 删除插件的负例发布 App 被拒绝;正常三个 npm 包均为 1.1.0,包含六个 runtime 与 ocu alias,没有 optionalDependencies。
+- 英文 Release notes 三条变更与 v1.0.0...v1.1.0 changelog 校验通过;直接下载归档 SHA256SUMS 校验通过;CursorMotion-1.1.0.dmg 本地构建通过。
+- 本轮只构建制品,不安装系统组件或重新锁屏。main 合并后的实现与此前已通过的正常 enable / MCP 完整 GUI 闭环一致;不将架构检查冒充 Intel 实机或完整故障矩阵验收。
+
+## 发布状态
+
+等待本地 pack 完成后提交版本、推送 main / tag,并检查 CI 公证、npm 与 GitHub Release。
diff --git a/docs/locked-use.en.md b/docs/locked-use.en.md
index 8cf02ef..c9fcf16 100644
--- a/docs/locked-use.en.md
+++ b/docs/locked-use.en.md
@@ -6,7 +6,7 @@ Locked Use lets an agent keep using GUI apps while your Mac is locked. Shields c
## How to enable it
-You need macOS 14 or later and a signed OCU app that includes the Locked Use components. For a source build, set `OPEN_COMPUTER_USE_INCLUDE_LOCKED_USE=1`.
+You need macOS 14 or later and a signed OCU app that includes the Locked Use components. Signed release builds include these components by default. For a development build, set `OPEN_COMPUTER_USE_INCLUDE_LOCKED_USE=1`.
Unlock your Mac normally, then run this command and complete the administrator prompt:
diff --git a/docs/locked-use.zh-CN.md b/docs/locked-use.zh-CN.md
index 5a0d128..471ab35 100644
--- a/docs/locked-use.zh-CN.md
+++ b/docs/locked-use.zh-CN.md
@@ -6,7 +6,7 @@ Locked Use 可以让 Agent 在 Mac 锁屏时继续操作 GUI。期间所有屏
## 如何开启
-需要 macOS 14 或更新版本,以及包含 Locked Use 组件的签名 OCU App。自行构建时设置 `OPEN_COMPUTER_USE_INCLUDE_LOCKED_USE=1`。
+需要 macOS 14 或更新版本,以及包含 Locked Use 组件的签名 OCU App。签名的正式构建会默认包含这些组件;自行构建开发版时设置 `OPEN_COMPUTER_USE_INCLUDE_LOCKED_USE=1`。
先正常解锁 Mac,然后运行下面的命令,完成管理员授权:
diff --git a/docs/releases/RELEASE_GUIDE.md b/docs/releases/RELEASE_GUIDE.md
index 6d3a94b..2f9e658 100644
--- a/docs/releases/RELEASE_GUIDE.md
+++ b/docs/releases/RELEASE_GUIDE.md
@@ -184,10 +184,11 @@ gh run view -R iFurySt/open-codex-computer-use <run-id> --log-failed
## 当前已知边界
-- `Open Computer Use` 的 npm release 产物在没有配置 `OPEN_COMPUTER_USE_CODESIGN_P12_BASE64` / `OPEN_COMPUTER_USE_CODESIGN_P12_PASSWORD` 等 secrets 时,仍会退回 ad-hoc signing;配置后会先导入 `Developer ID Application` 证书,再按该 identity 统一签名。
+- `Open Computer Use` 的正式 npm / 直接下载制品需要配置 `OPEN_COMPUTER_USE_CODESIGN_P12_BASE64` / `OPEN_COMPUTER_USE_CODESIGN_P12_PASSWORD`;导入 Developer ID 身份后按同一 team 签名主 App 与 Locked Use 组件。缺少签名时正式发布失败;日常无签名构建可显式关闭 Locked Use 嵌入。
- 如果 Open Computer Use 已使用 Developer ID 签名且 `APPLE_NOTARY_*` secrets 齐全,workflow 会 notarize 并 staple direct-download `.app` 后重新生成 app zip、checksums 和 manifest;缺少任一条件时跳过 notarization。
- `Cursor Motion` 当前 release 资产会优先复用 `OPEN_COMPUTER_USE_CODESIGN_*` 对 app 做 `Developer ID Application` 签名;如果同时配置 `APPLE_NOTARY_API_KEY_P8_BASE64`、`APPLE_NOTARY_KEY_ID`、`APPLE_NOTARY_ISSUER_ID`、`APPLE_DEVELOPER_TEAM_ID`,workflow 会继续对 `.dmg` 执行 notarization 和 staple。
-- 如果上述 secrets 缺失,workflow 会分别退回 ad-hoc signing 或跳过 notarization,而不是阻塞整条 release。
+- Open Computer Use 的正式发布必须包含 Locked Use 签名组件,缺少 Apple 签名身份时构建失败,不能静默发布不完整的 App;公证凭据缺失仍可跳过 notarization。
+- 签名 release App 默认自动构建并内嵌与主 App 同架构的 Locked Use 组件;支持 native / arm64 / x86_64 / universal。CI 显式设置 OPEN_COMPUTER_USE_INCLUDE_LOCKED_USE=1,制品检查覆盖四个组件的架构和严格嵌套签名。
- `open-computer-use` npm root 包会内置六个 `os-arch` native artifacts,包体积会比 macOS-only 版本更大;release 前要确认 staging 包里包含 `dist/Open Computer Use.app`、`dist/linux/` 和 `dist/windows/`,并确认 launcher 没有声明 `optionalDependencies`。
- 直接下载的 Linux / Windows CLI archive 只包含 native CLI / MCP runtime;`ocu js` / `ocu repl` 所需的 Node adapter 继续通过 npm 包分发。
- macOS direct download 必须保留完整 `.app` bundle;不要单独分发 `Contents/MacOS/OpenComputerUse`,否则无法可靠复用 app-scoped 权限身份。
diff --git a/scripts/build-locked-use-components.sh b/scripts/build-locked-use-components.sh
index 57c0839..02ea36d 100755
--- a/scripts/build-locked-use-components.sh
+++ b/scripts/build-locked-use-components.sh
@@ -3,53 +3,70 @@
set -euo pipefail
identity=""
configuration="debug"
+arch_mode="native"
while [[ $# -gt 0 ]]; do
case "$1" in
--identity) identity="${2:?Missing signing identity}"; shift 2 ;;
--configuration) configuration="${2:?Missing configuration}"; shift 2 ;;
- *) echo 'Usage: scripts/build-locked-use-components.sh --identity ID [--configuration debug|release]' >&2; exit 64 ;;
+ --arch) arch_mode="${2:?Missing architecture}"; shift 2 ;;
+ *) echo 'Usage: scripts/build-locked-use-components.sh --identity ID [--configuration debug|release] [--arch native|arm64|x86_64|universal]' >&2; exit 64 ;;
esac
done
[[ -n "$identity" && "$identity" != - ]] || exit 64
[[ "$configuration" == debug || "$configuration" == release ]] || exit 64
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
-swift build -c "$configuration" --product OCULockService
-swift build -c "$configuration" --product OCULockInstaller
-binary_dir="$(swift build -c "$configuration" --show-bin-path)"
+source "$repo_root/scripts/locked-use-build-common.sh"
+locked_use_architectures
output="$repo_root/.build/locked-use/components"
guardian_source=".build/locked-use/OCU Guardian (Dev).app"
if [[ "$configuration" == release ]]; then
output="$repo_root/.build/locked-use/components-release"
guardian_source=".build/locked-use/release/OCU Guardian.app"
fi
+if [[ "$arch_mode" != native ]]; then
+ output="$output-$arch_mode"
+ guardian_source="$(dirname "$guardian_source")-$arch_mode/$(basename "$guardian_source")"
+fi
mkdir -p "$output"
-cp "$binary_dir/OCULockService" "$output/OCULockService"
-cp "$binary_dir/OCULockInstaller" "$output/OCULockInstaller"
-codesign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.installer \
+locked_use_build_product OCULockService "$output/OCULockService"
+locked_use_build_product OCULockInstaller "$output/OCULockInstaller"
+locked_use_sign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.installer \
--sign "$identity" "$output/OCULockInstaller"
-codesign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.broker \
+locked_use_sign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.broker \
--sign "$identity" "$output/OCULockService"
team="$(codesign -dv --verbose=4 "$output/OCULockService" 2>&1 | sed -n 's/^TeamIdentifier=//p')"
if [[ ! "$team" =~ ^[A-Z0-9]{10}$ ]]; then echo 'Developer ID team unavailable.' >&2; exit 1; fi
-scripts/build-locked-use-guardian.sh --identity "$identity" --configuration "$configuration"
+scripts/build-locked-use-guardian.sh --identity "$identity" --configuration "$configuration" --arch "$arch_mode"
ditto "$guardian_source" "$output/$(basename "$guardian_source")"
bundle="$output/OCULockAuth.bundle"
mkdir -p "$bundle/Contents/MacOS"
native_arch="$(uname -m)"
-xcrun swiftc -parse-as-library -emit-object -target "$native_arch-apple-macos14.0" \
- -module-name OCULockedUseTaskVerifier experiments/LockedUse/AuthorizationPlugin/TaskVerifier.swift \
- -o "$output/task-verifier.o"
-xcrun clang -fobjc-arc -std=gnu11 -Wall -Wextra -Werror -fvisibility=hidden -mmacosx-version-min=14.0 \
- "-DOCU_SIGNING_TEAM=\"$team\"" -I packages/LockedUseNative/include -c \
- experiments/LockedUse/AuthorizationPlugin/RemotePlugin.m -o "$output/remote-plugin.o"
-xcrun clang -std=gnu11 -Wall -Wextra -Werror -mmacosx-version-min=14.0 \
- -I packages/LockedUseNative/include -c packages/LockedUseNative/PeerIdentity.c -o "$output/plugin-peer.o"
-xcrun swiftc -emit-library -Xlinker -bundle -target "$native_arch-apple-macos14.0" \
- -framework Security -framework Foundation -lbsm \
- "$output/remote-plugin.o" "$output/plugin-peer.o" "$output/task-verifier.o" \
- -o "$bundle/Contents/MacOS/OCULockAuth"
-cat > "$bundle/Contents/Info.plist" <<'PLIST'
+plugin_binaries=()
+for arch in "${architectures[@]}"; do
+ objects="$output/plugin-$arch"
+ mkdir -p "$objects"
+ xcrun swiftc -parse-as-library -emit-object -target "$arch-apple-macos14.0" \
+ -module-name OCULockedUseTaskVerifier experiments/LockedUse/AuthorizationPlugin/TaskVerifier.swift \
+ -o "$objects/task-verifier.o"
+ xcrun clang -target "$arch-apple-macos14.0" -fobjc-arc -std=gnu11 -Wall -Wextra -Werror -fvisibility=hidden \
+ "-DOCU_SIGNING_TEAM=\"$team\"" -I packages/LockedUseNative/include -c \
+ experiments/LockedUse/AuthorizationPlugin/RemotePlugin.m -o "$objects/remote-plugin.o"
+ xcrun clang -target "$arch-apple-macos14.0" -std=gnu11 -Wall -Wextra -Werror \
+ -I packages/LockedUseNative/include -c packages/LockedUseNative/PeerIdentity.c -o "$objects/plugin-peer.o"
+ xcrun swiftc -emit-library -Xlinker -bundle -target "$arch-apple-macos14.0" \
+ -framework Security -framework Foundation -lbsm \
+ "$objects/remote-plugin.o" "$objects/plugin-peer.o" "$objects/task-verifier.o" \
+ -o "$objects/OCULockAuth"
+ plugin_binaries+=("$objects/OCULockAuth")
+done
+if [[ "${#plugin_binaries[@]}" == 1 ]]; then
+ cp "${plugin_binaries[0]}" "$bundle/Contents/MacOS/OCULockAuth"
+else
+ lipo -create -output "$bundle/Contents/MacOS/OCULockAuth" "${plugin_binaries[@]}"
+fi
+lipo "$bundle/Contents/MacOS/OCULockAuth" -verify_arch "${architectures[@]}"
+cat > "$bundle/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
@@ -57,12 +74,13 @@ cat > "$bundle/Contents/Info.plist" <<'PLIST'
<key>CFBundleExecutable</key><string>OCULockAuth</string>
<key>CFBundlePackageType</key><string>BNDL</string>
<key>CFBundleVersion</key><string>1</string>
-<key>CFBundleShortVersionString</key><string>0.0.1</string>
+<key>CFBundleShortVersionString</key><string>${locked_use_version}</string>
</dict></plist>
PLIST
-codesign --force --options runtime --timestamp --sign "$identity" "$bundle"
+locked_use_sign --force --options runtime --timestamp --sign "$identity" "$bundle"
codesign --verify --strict "$bundle"
codesign --verify --strict "$output/OCULockService"
+if [[ " ${architectures[*]} " == *" $native_arch "* ]]; then
xcrun clang -std=c11 -Wall -Wextra -Werror -mmacosx-version-min=14.0 -framework Security \
experiments/LockedUse/AuthorizationPlugin/RemotePluginTests.c -o "$output/remote-plugin-abi-tests"
"$output/remote-plugin-abi-tests" "$bundle/Contents/MacOS/OCULockAuth"
@@ -72,35 +90,39 @@ xcrun clang -std=c11 -Wall -Wextra -Werror -mmacosx-version-min=14.0 -framework
test_output="$(mktemp -d "$output/task-verifier-checks.XXXXXX")"
xcrun clang -Wall -Wextra -Werror -mmacosx-version-min=14.0 "-DOCU_SIGNING_TEAM=\"$team\"" -c \
experiments/LockedUse/AuthorizationPlugin/TaskVerifierTests.c -o "$test_output/task-verifier-tests.o"
-xcrun swiftc -target "$native_arch-apple-macos14.0" "$test_output/task-verifier-tests.o" "$output/task-verifier.o" \
+xcrun swiftc -target "$native_arch-apple-macos14.0" "$test_output/task-verifier-tests.o" "$output/plugin-$native_arch/task-verifier.o" \
-o "$test_output/task-verifier-tests"
-codesign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.broker \
+locked_use_sign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.broker \
--sign "$identity" "$test_output/task-verifier-tests"
"$test_output/task-verifier-tests" match
rm -f "$test_output/task-verifier-wrong-id"
cp "$test_output/task-verifier-tests" "$test_output/task-verifier-wrong-id"
-codesign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.wrong \
+locked_use_sign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.wrong \
--sign "$identity" "$test_output/task-verifier-wrong-id"
"$test_output/task-verifier-wrong-id" reject
rm -f "$test_output/task-verifier-adhoc"
cp "$test_output/task-verifier-tests" "$test_output/task-verifier-adhoc"
-codesign --force --options runtime --identifier dev.opencomputeruse.locked-use.broker --sign - "$test_output/task-verifier-adhoc"
+locked_use_sign --force --options runtime --identifier dev.opencomputeruse.locked-use.broker --sign - "$test_output/task-verifier-adhoc"
"$test_output/task-verifier-adhoc" reject
-cat > "$test_output/task-verifier-debug.plist" <<'PLIST'
+cat > "$test_output/task-verifier-debug.plist" <<PLIST
<plist version="1.0"><dict><key>com.apple.security.get-task-allow</key><true/></dict></plist>
PLIST
rm -f "$test_output/task-verifier-debug"
cp "$test_output/task-verifier-tests" "$test_output/task-verifier-debug"
-codesign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.broker \
+locked_use_sign --force --options runtime --timestamp --identifier dev.opencomputeruse.locked-use.broker \
--entitlements "$test_output/task-verifier-debug.plist" --sign "$identity" "$test_output/task-verifier-debug"
"$test_output/task-verifier-debug" reject
+else
+ echo 'Cross-target build: runtime ABI tests require a matching host architecture.'
+fi
echo 'Signed Broker, Guardian and remote plugin built. No system files or authorization rules changed.'
if [[ "$configuration" == debug ]]; then
+binary_dir="$(swift build -c "$configuration" --show-bin-path)"
fixture="$output/OCU Lock Demo (Dev).app"
mkdir -p "$fixture/Contents/MacOS"
cp "$binary_dir/OCUGuardian" "$fixture/Contents/MacOS/OCUGuardian"
-cat > "$fixture/Contents/Info.plist" <<'PLIST'
+cat > "$fixture/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
@@ -112,6 +134,6 @@ cat > "$fixture/Contents/Info.plist" <<'PLIST'
<key>NSPrincipalClass</key><string>NSApplication</string>
</dict></plist>
PLIST
-codesign --force --options runtime --timestamp --sign "$identity" "$fixture"
+locked_use_sign --force --options runtime --timestamp --sign "$identity" "$fixture"
fi
diff --git a/scripts/build-locked-use-guardian.sh b/scripts/build-locked-use-guardian.sh
index 9c5387a..b01ed85 100755
--- a/scripts/build-locked-use-guardian.sh
+++ b/scripts/build-locked-use-guardian.sh
@@ -4,27 +4,30 @@ set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
identity="-"
configuration="debug"
+arch_mode="native"
while [[ $# -gt 0 ]]; do
case "$1" in
--identity) identity="${2:?Missing signing identity}"; shift 2 ;;
--configuration) configuration="${2:?Missing configuration}"; shift 2 ;;
- *) echo 'Usage: scripts/build-locked-use-guardian.sh [--identity ID] [--configuration debug|release]' >&2; exit 64 ;;
+ --arch) arch_mode="${2:?Missing architecture}"; shift 2 ;;
+ *) echo 'Usage: scripts/build-locked-use-guardian.sh [--identity ID] [--configuration debug|release] [--arch native|arm64|x86_64|universal]' >&2; exit 64 ;;
esac
done
[[ "$configuration" == debug || "$configuration" == release ]] || exit 64
cd "$repo_root"
-swift build -c "$configuration" --product OCUGuardian
-binary_dir="$(swift build -c "$configuration" --show-bin-path)"
+source "$repo_root/scripts/locked-use-build-common.sh"
+locked_use_architectures
name="OCU Guardian (Dev)"
output="$repo_root/.build/locked-use"
if [[ "$configuration" == release ]]; then
name="OCU Guardian"
output="$output/release"
fi
+if [[ "$arch_mode" != native ]]; then output="$output-$arch_mode"; fi
app_path="$output/$name.app"
mkdir -p "$app_path/Contents/MacOS" "$app_path/Contents/Resources"
cp "$repo_root/assets/app-icons/open-computer-use-1024.png" "$app_path/Contents/Resources/OCUShieldLogo.png"
-cp "$binary_dir/OCUGuardian" "$app_path/Contents/MacOS/OCUGuardian"
+locked_use_build_product OCUGuardian "$app_path/Contents/MacOS/OCUGuardian"
cat > "$app_path/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -34,15 +37,15 @@ cat > "$app_path/Contents/Info.plist" <<PLIST
<key>CFBundleName</key><string>${name}</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleVersion</key><string>1</string>
-<key>CFBundleShortVersionString</key><string>0.0.1</string>
+<key>CFBundleShortVersionString</key><string>${locked_use_version}</string>
<key>LSUIElement</key><true/>
-<key>NSInputMonitoringUsageDescription</key><string>Detect local takeover and relock during the Locked Use rehearsal.</string>
+<key>NSInputMonitoringUsageDescription</key><string>Detect local takeover and relock during Locked Use.</string>
</dict></plist>
PLIST
if [[ "$identity" == "-" ]]; then
- codesign --force --sign - "$app_path"
+ locked_use_sign --force --sign - "$app_path"
else
- codesign --force --options runtime --timestamp --sign "$identity" "$app_path"
+ locked_use_sign --force --options runtime --timestamp --sign "$identity" "$app_path"
fi
codesign --verify --strict "$app_path"
printf '%s\n' "$app_path"
diff --git a/scripts/build-open-computer-use-app.sh b/scripts/build-open-computer-use-app.sh
index 5df339f..f509682 100755
--- a/scripts/build-open-computer-use-app.sh
+++ b/scripts/build-open-computer-use-app.sh
@@ -373,21 +373,27 @@ cat > "${contents_dir}/Info.plist" <<PLIST
</plist>
PLIST
-if [[ "${OPEN_COMPUTER_USE_INCLUDE_LOCKED_USE:-0}" == 1 ]]; then
- if [[ "${arch_mode}" != native ]]; then
- echo 'Locked Use components currently require the native architecture build.' >&2
+locked_use_requested="${OPEN_COMPUTER_USE_INCLUDE_LOCKED_USE:-auto}"
+locked_use_identity="$(resolve_codesign_identity || true)"
+if [[ "$locked_use_requested" == auto ]]; then
+ locked_use_requested=0
+ if [[ "$configuration" == release && -n "$locked_use_identity" && "$locked_use_identity" != - ]]; then
+ locked_use_requested=1
+ fi
+fi
+if [[ "$locked_use_requested" == 1 ]]; then
+ if [[ -z "$locked_use_identity" || "$locked_use_identity" == - ]]; then
+ echo 'Locked Use requires an Apple signing identity; refusing an incomplete release.' >&2
exit 1
fi
+ scripts/build-locked-use-components.sh --configuration "$configuration" --arch "$arch_mode" --identity "$locked_use_identity"
locked_use_components="${repo_root}/.build/locked-use/components"
guardian_component="OCU Guardian (Dev).app"
if [[ "${app_variant}" == release ]]; then
locked_use_components="${repo_root}/.build/locked-use/components-release"
guardian_component="OCU Guardian.app"
fi
- if [[ ! -x "${locked_use_components}/OCULockInstaller" ]]; then
- echo 'Build signed Locked Use components before embedding them.' >&2
- exit 1
- fi
+ if [[ "$arch_mode" != native ]]; then locked_use_components="$locked_use_components-$arch_mode"; fi
mkdir -p "${resources_dir}/LockedUse"
for component in OCULockService OCULockInstaller OCULockAuth.bundle; do
ditto "${locked_use_components}/${component}" "${resources_dir}/LockedUse/${component}"
@@ -397,5 +403,8 @@ fi
plutil -lint "${contents_dir}/Info.plist" >/dev/null
codesign_app_bundle "${app_root}"
+if [[ "$locked_use_requested" == 1 ]]; then
+ scripts/verify-locked-use-bundle.sh "$app_root"
+fi
echo "Built ${app_root} (${arch_mode}, ${configuration})"
diff --git a/scripts/locked-use-build-common.sh b/scripts/locked-use-build-common.sh
new file mode 100644
index 0000000..a6b6572
--- /dev/null
+++ b/scripts/locked-use-build-common.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+# Shared build helpers. Callers define repo_root, configuration and arch_mode.
+locked_use_architectures() {
+ case "$arch_mode" in
+ native) architectures=("$(uname -m)") ;;
+ universal) architectures=(arm64 x86_64) ;;
+ arm64|x86_64) architectures=("$arch_mode") ;;
+ *) echo "Unsupported Locked Use architecture: $arch_mode" >&2; return 64 ;;
+ esac
+}
+
+locked_use_build_product() {
+ local product="$1" destination="$2" arch binary_dir
+ local binaries=()
+ for arch in "${architectures[@]}"; do
+ local args=(-c "$configuration")
+ if [[ "$arch_mode" != native ]]; then
+ args+=(--triple "${arch}-apple-macosx14.0" --scratch-path ".build/${arch}-${configuration}")
+ fi
+ swift build "${args[@]}" --product "$product"
+ binary_dir="$(swift build "${args[@]}" --show-bin-path)"
+ binaries+=("$binary_dir/$product")
+ done
+ if [[ "${#binaries[@]}" == 1 ]]; then
+ cp "${binaries[0]}" "$destination"
+ else
+ lipo -create -output "$destination" "${binaries[@]}"
+ fi
+ lipo "$destination" -verify_arch "${architectures[@]}"
+}
+
+locked_use_sign() {
+ local args=()
+ if [[ -n "${OPEN_COMPUTER_USE_CODESIGN_KEYCHAIN:-}" ]]; then
+ args+=(--keychain "$OPEN_COMPUTER_USE_CODESIGN_KEYCHAIN")
+ fi
+ /usr/bin/codesign "${args[@]}" "$@"
+}
+
+locked_use_version="$(python3 - "$repo_root/plugins/open-computer-use/.codex-plugin/plugin.json" <<'PYVERSION'
+import json, sys
+with open(sys.argv[1], encoding="utf-8") as source:
+ print(json.load(source)["version"])
+PYVERSION
+)"
diff --git a/scripts/npm/build-packages.mjs b/scripts/npm/build-packages.mjs
index 0a5465f..f49be81 100644
--- a/scripts/npm/build-packages.mjs
+++ b/scripts/npm/build-packages.mjs
@@ -536,6 +536,10 @@ function main() {
ensureBuilt(options.configuration, options.arch);
}
+ if (options.configuration === "release") {
+ run(path.join(repoRoot, "scripts", "verify-locked-use-bundle.sh"), [path.join(repoRoot, "dist", appBundleName)]);
+ }
+
rmSync(options.outDir, { recursive: true, force: true });
mkdirSync(options.outDir, { recursive: true });
diff --git a/scripts/package-github-release-assets.sh b/scripts/package-github-release-assets.sh
index d6d1ffd..4531162 100755
--- a/scripts/package-github-release-assets.sh
+++ b/scripts/package-github-release-assets.sh
@@ -96,6 +96,7 @@ if [[ " ${app_archs} " != *" arm64 "* || " ${app_archs} " != *" x86_64 "* ]]; th
exit 1
fi
codesign --verify --deep --strict "${app_path}"
+"${repo_root}/scripts/verify-locked-use-bundle.sh" "${app_path}"
rm -rf "${output_dir}"
mkdir -p "${output_dir}"
diff --git a/scripts/verify-locked-use-bundle.sh b/scripts/verify-locked-use-bundle.sh
new file mode 100755
index 0000000..b949663
--- /dev/null
+++ b/scripts/verify-locked-use-bundle.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# Read-only release validation: every runtime component matches the main App.
+set -euo pipefail
+app="${1:?Usage: scripts/verify-locked-use-bundle.sh APP}"
+base="$app/Contents/Resources/LockedUse"
+read -r -a architectures <<< "$(lipo -archs "$app/Contents/MacOS/OpenComputerUse")"
+team="$(codesign -dv --verbose=4 "$app" 2>&1 | sed -n 's/^TeamIdentifier=//p')"
+[[ "$team" =~ ^[A-Z0-9]{10}$ ]] || { echo 'Locked Use release requires an Apple signing team.' >&2; exit 1; }
+[[ -d "$base" ]] || { echo 'Locked Use runtime is missing from the App.' >&2; exit 1; }
+[[ "$(find "$base" -mindepth 1 -maxdepth 1 | wc -l | tr -d ' ')" == 4 ]] || { echo 'Unexpected Locked Use runtime components.' >&2; exit 1; }
+components=(OCULockService OCULockInstaller 'OCU Guardian.app' OCULockAuth.bundle)
+executables=(OCULockService OCULockInstaller 'OCU Guardian.app/Contents/MacOS/OCUGuardian' 'OCULockAuth.bundle/Contents/MacOS/OCULockAuth')
+identifiers=(dev.opencomputeruse.locked-use.broker dev.opencomputeruse.locked-use.installer dev.opencomputeruse.locked-use.guardian.dev dev.opencomputeruse.locked-use.authorization)
+for index in 0 1 2 3; do
+ [[ -x "$base/${executables[$index]}" ]]
+ lipo "$base/${executables[$index]}" -verify_arch "${architectures[@]}"
+ codesign --verify --strict -R "=identifier \"${identifiers[$index]}\" and anchor apple generic and certificate leaf[subject.OU] = \"$team\"" "$base/${components[$index]}"
+done
+codesign --verify --deep --strict "$app"
+echo "Locked Use bundle verified: ${architectures[*]}, four signed runtime components."