Skip to content

Commit fdf0e6f

Browse files
committed
release: publish beta packages
1 parent 4e5d176 commit fdf0e6f

File tree

9 files changed

+175
-6
lines changed

9 files changed

+175
-6
lines changed

.changeset/pre.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
"initialVersions": {
55
"ui-tars-desktop": "0.0.6-beta.1",
66
"@ui-tars/action-parser": "1.2.0-beta.6",
7-
"@ui-tars/cli": "1.2.0-beta.6",
7+
"@ui-tars/cli": "1.2.0-beta.7",
88
"@ui-tars/electron-ipc": "1.2.0-beta.6",
9-
"@ui-tars/operator-nut-js": "1.2.0-beta.6",
10-
"@ui-tars/sdk": "1.2.0-beta.6",
9+
"@ui-tars/operator-nut-js": "1.2.0-beta.7",
10+
"@ui-tars/sdk": "1.2.0-beta.7",
1111
"@ui-tars/shared": "1.2.0-beta.6",
1212
"@ui-tars/utio": "1.2.0-beta.6"
1313
},
@@ -19,6 +19,7 @@
1919
"large-mangos-push",
2020
"new-emus-hammer",
2121
"proud-buttons-drum",
22+
"slow-wasps-sing",
2223
"wicked-trains-smash"
2324
]
2425
}

.changeset/slow-wasps-sing.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@ui-tars/operator-nut-js': patch
3+
'@ui-tars/cli': patch
4+
'@ui-tars/sdk': patch
5+
---
6+
7+
fix: useConfig to useContext

docs/sdk.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# @ui-tars/sdk Guide
2+
3+
## Overview
4+
5+
`@ui-tars/sdk` is a powerful toolkit for building GUI automation agents. It provides a flexible framework to create agents that can interact with graphical user interfaces through various operators.
6+
7+
## Installation
8+
9+
```bash
10+
npm install @ui-tars/sdk
11+
```
12+
13+
```ts
14+
// packages/cli/src/cli/start.ts
15+
16+
import { GUIAgent } from '@ui-tars/sdk';
17+
import { NutJSOperator } from '@ui-tars/operator-nut-js';
18+
19+
const answers = await inquirer.prompt([
20+
{
21+
type: 'input',
22+
name: 'instruction',
23+
message: 'Input input your instruction',
24+
},
25+
]);
26+
27+
const abortController = new AbortController();
28+
process.on('SIGINT', () => {
29+
abortController.abort();
30+
});
31+
32+
const guiAgent = new GUIAgent({
33+
model: {
34+
baseURL: config.baseURL,
35+
apiKey: config.apiKey,
36+
model: config.model,
37+
},
38+
operator: new NutJSOperator({}),
39+
signal: abortController.signal,
40+
onData: ({ data }) => {
41+
console.log(data)
42+
},
43+
onError: ({ data, error }) => {
44+
console.error(error, data);
45+
},
46+
});
47+
48+
await guiAgent.run('send "hello world" to x.com');
49+
```
50+
51+
#### Custom Operator
52+
53+
like `nut-js`
54+
55+
```ts
56+
// packages/operators/nut-js/src/index.ts
57+
import {
58+
Operator,
59+
useConfig,
60+
type ScreenshotOutput,
61+
type ExecuteParams,
62+
} from '@ui-tars/sdk/core';
63+
64+
export class NutJSOperator extends Operator {
65+
public async screenshot(): Promise<ScreenshotOutput> {
66+
// implements
67+
}
68+
69+
async execute(params: ExecuteParams): Promise<void> {
70+
// implements
71+
}
72+
}
73+
```
74+
75+
76+
### Desktop Agent
77+
78+
✨ Build ANY device/platform Computer Use logic.
79+
80+
⚡ Can't wait to see operators for every platform emerge! The era of AI-driven universal device control starts NOW.
81+
82+
```ts
83+
import { GUIAgent } from '@ui-tars/sdk';
84+
import { NutJSOperator } from '@ui-tars/operator-nut-js';
85+
86+
const abortController = new AbortController();
87+
const guiAgent = new GUIAgent({
88+
operator: new NutJSOperator({}),
89+
// openai params
90+
model: {
91+
baseURL: 'https://<your_endpoints>.huggingface.cloud/v1/',
92+
apiKey: 'sk-proj-1234567890',
93+
model: 'UI-TARS-7B-SFT',
94+
headers: {},
95+
},
96+
signal?: abortController.signal,
97+
onData?: ({ data }) => {
98+
console.log(data);
99+
},
100+
onError?: ({ data, error }) => {
101+
console.error(error);
102+
},
103+
systemPrompt?: 'override system prompt',
104+
});
105+
106+
await guiAgent.run('send "hello world" to x.com'); // instruction
107+
```
108+
109+
### Planning
110+
111+
```ts
112+
const guiAgent = new GUIAgent({});
113+
114+
const planningList = await reasoningModel.invoke({
115+
conversations: [
116+
{
117+
role: 'user',
118+
content: 'buy a ticket from beijing to shanghai',
119+
}
120+
]
121+
})
122+
/**
123+
* [
124+
* 'open chrome',
125+
* 'open trip.com',
126+
* 'click "search" button',
127+
* 'select "beijing" in "from" input',
128+
* 'select "shanghai" in "to" input',
129+
* 'click "search" button',
130+
* ]
131+
*/
132+
133+
for (const planning of planningList) {
134+
await guiAgent.run(planning);
135+
}
136+
```
137+
138+

packages/cli/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @ui-tars/cli
22

3+
## 1.2.0-beta.8
4+
5+
### Patch Changes
6+
7+
- fix: useConfig to useContext
8+
- Updated dependencies
9+
- @ui-tars/operator-nut-js@1.2.0-beta.8
10+
- @ui-tars/sdk@1.2.0-beta.8
11+
312
## 1.2.0-beta.7
413

514
### Patch Changes

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ui-tars/cli",
3-
"version": "1.2.0-beta.7",
3+
"version": "1.2.0-beta.8",
44
"description": "CLI for UI-TARS",
55
"repository": {
66
"type": "git",

packages/operators/nut-js/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @ui-tars/operator-nut-js
22

3+
## 1.2.0-beta.8
4+
5+
### Patch Changes
6+
7+
- fix: useConfig to useContext
8+
- Updated dependencies
9+
- @ui-tars/sdk@1.2.0-beta.8
10+
311
## 1.2.0-beta.7
412

513
### Patch Changes

packages/operators/nut-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ui-tars/operator-nut-js",
3-
"version": "1.2.0-beta.7",
3+
"version": "1.2.0-beta.8",
44
"description": "Operator Nut JS SDK for UI-TARS",
55
"repository": {
66
"type": "git",

packages/sdk/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @ui-tars/sdk
22

3+
## 1.2.0-beta.8
4+
5+
### Patch Changes
6+
7+
- fix: useConfig to useContext
8+
39
## 1.2.0-beta.7
410

511
### Patch Changes

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ui-tars/sdk",
3-
"version": "1.2.0-beta.7",
3+
"version": "1.2.0-beta.8",
44
"description": "GUI Agent SDK for UI-TARS",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)