Skip to content

Commit 9db3f70

Browse files
authored
feat: add default osx sign (#17)
* chore: add default osx sign * chore(ci): test case * feat: support osx app sign * chore: e * chore: hardenedRuntime * chore: hardenedRuntime * chore: hardened-runtime * chore: replace with computer-use pkgs * chore: macos * chore: remove @electron/notarize * chore: version
1 parent b607567 commit 9db3f70

File tree

8 files changed

+127
-64
lines changed

8 files changed

+127
-64
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ env:
1111
HUSKY: 0
1212

1313
jobs:
14-
publish_on_mac_arm64:
15-
runs-on: macos-latest
14+
publish_on_mac:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [macos-latest, macos-13]
19+
runs-on: ${{ matrix.os }}
1620
steps:
1721
- uses: actions/checkout@v4
1822
- name: Show operating system info
@@ -29,36 +33,54 @@ jobs:
2933
run: brew install python-setuptools
3034
- name: Install appdmg
3135
run: npm install -g appdmg
36+
- name: Install the Apple certificate and provisioning profile
37+
env:
38+
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
39+
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
40+
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
41+
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
42+
run: |
43+
# create variables
44+
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
45+
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
46+
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
47+
48+
# import certificate and provisioning profile from secrets
49+
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
50+
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
51+
52+
# create temporary keychain
53+
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
54+
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
55+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
56+
57+
# import certificate to keychain
58+
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
59+
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
60+
security list-keychain -d user -s $KEYCHAIN_PATH
61+
62+
# apply provisioning profile
63+
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
64+
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
3265
- name: install dependencies
3366
run: pnpm install
34-
- name: publish
67+
- name: publish arm64
68+
if: matrix.os == 'macos-latest'
3569
env:
70+
APPLE_ID: ${{ secrets.APPLE_ID }}
71+
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
72+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
73+
KEYCHAIN_PATH: ${{ runner.temp }}/app-signing.keychain-db
3674
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3775
run: |
3876
pnpm run publish:mac-arm64
39-
40-
publish_on_mac_x64:
41-
runs-on: macos-13
42-
steps:
43-
- uses: actions/checkout@v4
44-
- name: Show operating system info
45-
run: |
46-
echo "Operating System:"
47-
uname -a
48-
- name: Install pnpm
49-
run: npm install -g pnpm@9
50-
- uses: actions/setup-node@v4
51-
with:
52-
node-version: 20
53-
cache: 'pnpm'
54-
- name: Install Python setuptools
55-
run: brew install python-setuptools
56-
- name: Install appdmg
57-
run: npm install -g appdmg
58-
- name: install dependencies
59-
run: pnpm install
60-
- name: publish
77+
- name: publish x64
78+
if: matrix.os == 'macos-13'
6179
env:
80+
APPLE_ID: ${{ secrets.APPLE_ID }}
81+
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
82+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
83+
KEYCHAIN_PATH: ${{ runner.temp }}/app-signing.keychain-db
6284
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6385
run: |
6486
pnpm run publish:mac-x64

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ UI-TARS Desktop is a GUI Agent application based on [UI-TARS (Vision-Language Mo
1919

2020
### ⚠️ Important Announcement: GGUF Model Performance
2121

22-
The **GGUF model** has undergone quantization, but unfortunately, its performance cannot be guaranteed. As a result, we have decided to **downgrade** it.
22+
The **GGUF model** has undergone quantization, but unfortunately, its performance cannot be guaranteed. As a result, we have decided to **downgrade** it.
2323

24-
💡 **Alternative Solution**:
25-
You can use **[Cloud Deployment](#cloud-deployment)** or **[Local Deployment [vLLM]](#local-deployment-vllm)**(If you have enough GPU resources) instead.
24+
💡 **Alternative Solution**:
25+
You can use **[Cloud Deployment](#cloud-deployment)** or **[Local Deployment [vLLM]](#local-deployment-vllm)**(If you have enough GPU resources) instead.
2626

2727
We appreciate your understanding and patience as we work to ensure the best possible experience.
2828

@@ -54,10 +54,6 @@ You can download the [latest release](https://github.com/bytedance/UI-TARS-deskt
5454
1. Drag **UI TARS** application into the **Applications** folder
5555
<img src="./images/mac_install.png" width="500px" />
5656

57-
> **Note**: If app broken, you can use `sudo xattr -dr com.apple.quarantine /Applications/UI\ TARS.app` in Terminal to fix it.
58-
>
59-
> <img src="./images/mac_broken.png" width="400px" />
60-
6157
2. Enable the permission of **UI TARS** in MacOS:
6258
- System Settings -> Privacy & Security -> **Accessibility**
6359
- System Settings -> Privacy & Security -> **Screen Recording**

build/entitlements.mac.plist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
</dict>
8+
</plist>

forge.config.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const config: ForgeConfig = {
8787
unpack: [
8888
'**/node_modules/sharp/**/*',
8989
'**/node_modules/@img/**/*',
90-
'**/node_modules/mac-screen-capture-permissions/**/*',
90+
'**/node_modules/@computer-use/mac-screen-capture-permissions/**/*',
9191
],
9292
},
9393
afterCopy: [
@@ -99,6 +99,23 @@ const config: ForgeConfig = {
9999
prune: true,
100100
executableName: 'UI-TARS',
101101
extraResource: ['./resources/app-update.yml', './resources/report.html'],
102+
...(process.env.APPLE_ID &&
103+
process.env.APPLE_PASSWORD &&
104+
process.env.APPLE_TEAM_ID
105+
? {
106+
osxSign: {
107+
keychain: process.env.KEYCHAIN_PATH,
108+
optionsForFile: () => ({
109+
entitlements: 'build/entitlements.mac.plist',
110+
}),
111+
},
112+
osxNotarize: {
113+
appleId: process.env.APPLE_ID,
114+
appleIdPassword: process.env.APPLE_PASSWORD,
115+
teamId: process.env.APPLE_TEAM_ID,
116+
},
117+
}
118+
: {}),
102119
},
103120
rebuildConfig: {},
104121
publishers: [

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ui-tars-desktop",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"private": true,
55
"packageManager": "pnpm@9.10.0",
66
"description": "Control your computer with Agent",
@@ -38,11 +38,11 @@
3838
"prepare": "husky"
3939
},
4040
"dependencies": {
41+
"@computer-use/mac-screen-capture-permissions": "^1.0.2",
4142
"@computer-use/node-mac-permissions": "2.2.2",
4243
"@computer-use/nut-js": "^4.2.0",
4344
"@electron-toolkit/preload": "^3.0.1",
4445
"@electron-toolkit/utils": "^3.0.0",
45-
"@electron/notarize": "^2.3.2",
4646
"@ui-tars/action-parser": "workspace:*",
4747
"@ui-tars/shared": "workspace:*",
4848
"async-retry": "^1.3.3",
@@ -56,7 +56,6 @@
5656
"electron-updater": "^6.1.4",
5757
"js-yaml": "^4.1.0",
5858
"lodash-es": "4.17.21",
59-
"mac-screen-capture-permissions": "2.1.0",
6059
"ms": "^2.1.3",
6160
"openai": "4.73.0",
6261
"react-use": "^17.6.0",

pnpm-lock.yaml

Lines changed: 13 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/agent/execute.ts

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,29 @@ const moveStraightTo = async (startX: number | null, startY: number | null) => {
2828
await mouse.move(straightTo(new Point(startX, startY)));
2929
};
3030

31+
const parseBoxToScreenCoordsWithScaleFactor = ({
32+
boxStr,
33+
screenWidth,
34+
screenHeight,
35+
scaleFactor,
36+
}: {
37+
boxStr: string;
38+
screenWidth: number;
39+
screenHeight: number;
40+
scaleFactor: number;
41+
}) => {
42+
const { x: _x, y: _y } = boxStr
43+
? parseBoxToScreenCoords(boxStr, screenWidth, screenHeight)
44+
: { x: null, y: null };
45+
46+
const x = _x ? _x * scaleFactor : null;
47+
const y = _y ? _y * scaleFactor : null;
48+
return {
49+
x,
50+
y,
51+
};
52+
};
53+
3154
export interface ExecuteParams {
3255
scaleFactor?: number;
3356
prediction: PredictionParsed;
@@ -61,14 +84,14 @@ export const execute = async (executeParams: ExecuteParams) => {
6184

6285
logger.info('[execute] action_type', action_type, 'startBoxStr', startBoxStr);
6386

64-
const { x, y } = startBoxStr
65-
? parseBoxToScreenCoords(startBoxStr, screenWidth, screenHeight)
66-
: { x: null, y: null };
67-
68-
const startX = x ? x * scaleFactor : null;
69-
const startY = y ? y * scaleFactor : null;
87+
const { x: startX, y: startY } = parseBoxToScreenCoordsWithScaleFactor({
88+
boxStr: startBoxStr,
89+
screenWidth,
90+
screenHeight,
91+
scaleFactor,
92+
});
7093

71-
logger.info(`[execute] [Position] (${x}, ${y}) => (${startX}, ${startY})`);
94+
logger.info(`[execute] [Position] (${startX}, ${startY})`);
7295

7396
// execute configs
7497
mouse.config.mouseSpeed = 1500;
@@ -129,11 +152,12 @@ export const execute = async (executeParams: ExecuteParams) => {
129152
logger.info('[device] drag', action_inputs);
130153
// end_box
131154
if (action_inputs?.end_box) {
132-
const { x: endX, y: endY } = parseBoxToScreenCoords(
133-
action_inputs.end_box,
155+
const { x: endX, y: endY } = parseBoxToScreenCoordsWithScaleFactor({
156+
boxStr: action_inputs.end_box,
134157
screenWidth,
135158
screenHeight,
136-
);
159+
scaleFactor,
160+
});
137161

138162
if (startX && startY && endX && endY) {
139163
// calculate x and y direction difference

src/main/utils/systemPermissions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* Copyright (c) 2025 Bytedance, Inc. and its affiliates.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
5-
import permissions from '@computer-use/node-mac-permissions';
65
import {
76
hasPromptedForPermission,
87
hasScreenCapturePermission,
98
openSystemPreferences,
10-
} from 'mac-screen-capture-permissions';
9+
} from '@computer-use/mac-screen-capture-permissions';
10+
import permissions from '@computer-use/node-mac-permissions';
1111

1212
import * as env from '@main/env';
1313
import { logger } from '@main/logger';

0 commit comments

Comments
 (0)