@amaster.ai/pi-computer-use 0.1.2-beta.1 → 0.1.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -0
- package/bin/darwin-arm64/cua-driver +0 -0
- package/bin/darwin-x64/cua-driver +0 -0
- package/bin/linux-x64/cua-driver +0 -0
- package/bin/win32-arm64/cua-driver.exe +0 -0
- package/bin/win32-x64/cua-driver.exe +0 -0
- package/dist/config.d.ts +7 -20
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -8
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +107 -79
- package/dist/index.js.map +1 -1
- package/dist/mcp-client.d.ts +22 -0
- package/dist/mcp-client.d.ts.map +1 -0
- package/dist/mcp-client.js +71 -0
- package/dist/mcp-client.js.map +1 -0
- package/package.json +14 -5
- package/dist/__tests__/computer-client.test.d.ts +0 -2
- package/dist/__tests__/computer-client.test.d.ts.map +0 -1
- package/dist/__tests__/computer-client.test.js +0 -174
- package/dist/__tests__/computer-client.test.js.map +0 -1
- package/dist/__tests__/index.test.d.ts +0 -2
- package/dist/__tests__/index.test.d.ts.map +0 -1
- package/dist/__tests__/index.test.js +0 -385
- package/dist/__tests__/index.test.js.map +0 -1
- package/dist/__tests__/server-process.test.d.ts +0 -2
- package/dist/__tests__/server-process.test.d.ts.map +0 -1
- package/dist/__tests__/server-process.test.js +0 -127
- package/dist/__tests__/server-process.test.js.map +0 -1
- package/dist/__tests__/vision.test.d.ts +0 -2
- package/dist/__tests__/vision.test.d.ts.map +0 -1
- package/dist/__tests__/vision.test.js +0 -36
- package/dist/__tests__/vision.test.js.map +0 -1
- package/dist/actions.d.ts +0 -15
- package/dist/actions.d.ts.map +0 -1
- package/dist/actions.js +0 -45
- package/dist/actions.js.map +0 -1
- package/dist/computer-client.d.ts +0 -13
- package/dist/computer-client.d.ts.map +0 -1
- package/dist/computer-client.js +0 -109
- package/dist/computer-client.js.map +0 -1
- package/dist/server-process.d.ts +0 -9
- package/dist/server-process.d.ts.map +0 -1
- package/dist/server-process.js +0 -76
- package/dist/server-process.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# @amaster.ai/pi-computer-use
|
|
2
|
+
|
|
3
|
+
pi-coding-agent extension that wraps [cua-driver-rs](https://github.com/trycua/cua/), exposing desktop automation tools with a `computer_use_` prefix.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Zero external dependencies** — pre-compiled cua-driver-rs binaries bundled for all platforms
|
|
8
|
+
- **MCP stdio communication** — spawns `cua-driver mcp` via `StdioClientTransport`, JSON-RPC over stdio
|
|
9
|
+
- **Dynamic tool discovery** — auto-discovers upstream MCP tools and registers with `computer_use_` prefix
|
|
10
|
+
- **Smart tool filtering** — excludes non-essential tools (agent cursor, recording, config), exposes 18 core tools
|
|
11
|
+
- **Optional visual analysis** — `computer_use_analyze_screenshot` via configurable vision model
|
|
12
|
+
- **Cross-platform** — darwin-arm64/x64, linux-x64, win32-x64/arm64
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
bun add @amaster.ai/pi-computer-use
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Requires Node.js >= 20 and `@earendil-works/pi-coding-agent >= 0.74.0`.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
Install the package and pi-coding-agent will automatically discover and load the extension. All tools are registered on `session_start`.
|
|
25
|
+
|
|
26
|
+
Configure via `.pi/settings.json` (project-level) or `~/.pi/agent/settings.json` (user-level) under the `"pi-computer-use"` key:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"pi-computer-use": {
|
|
31
|
+
"mode": "bundled"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Configuration
|
|
37
|
+
|
|
38
|
+
| Option | Type | Default | Description |
|
|
39
|
+
|--------|------|---------|-------------|
|
|
40
|
+
| `mode` | `'bundled' \| 'path'` | `'bundled'` | Binary resolution strategy |
|
|
41
|
+
| `binaryPath` | `string` | — | Custom cua-driver binary path (requires `mode: 'path'`) |
|
|
42
|
+
| `extraArgs` | `string[]` | — | Extra CLI arguments passed to cua-driver |
|
|
43
|
+
| `visionModel` | `VisionModelConfig` | — | Enable visual screenshot analysis |
|
|
44
|
+
|
|
45
|
+
### Vision Model (Optional)
|
|
46
|
+
|
|
47
|
+
Enable `computer_use_analyze_screenshot` by referencing a model already configured in Pi's model registry (`models.json`):
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"pi-computer-use": {
|
|
52
|
+
"visionModel": {
|
|
53
|
+
"provider": "openai",
|
|
54
|
+
"model": "gpt-4o"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The extension resolves API key, base URL, and headers from the model registry automatically — no need to duplicate credentials here.
|
|
61
|
+
|
|
62
|
+
## Exposed Tools (18)
|
|
63
|
+
|
|
64
|
+
### Core
|
|
65
|
+
|
|
66
|
+
| Tool | Description |
|
|
67
|
+
|------|-------------|
|
|
68
|
+
| `computer_use_screenshot` | Capture screen |
|
|
69
|
+
| `computer_use_click` | Click at coordinates |
|
|
70
|
+
| `computer_use_type_text` | Type text |
|
|
71
|
+
| `computer_use_press_key` | Press a keyboard key |
|
|
72
|
+
| `computer_use_scroll` | Scroll in a direction |
|
|
73
|
+
| `computer_use_hotkey` | Press key combination |
|
|
74
|
+
|
|
75
|
+
### Common
|
|
76
|
+
|
|
77
|
+
| Tool | Description |
|
|
78
|
+
|------|-------------|
|
|
79
|
+
| `computer_use_double_click` | Double-click |
|
|
80
|
+
| `computer_use_right_click` | Right-click (context menu) |
|
|
81
|
+
| `computer_use_drag` | Drag from one point to another |
|
|
82
|
+
| `computer_use_get_screen_size` | Get screen dimensions |
|
|
83
|
+
| `computer_use_get_accessibility_tree` | Get accessibility tree for element discovery |
|
|
84
|
+
| `computer_use_set_value` | Set form field value directly |
|
|
85
|
+
| `computer_use_get_cursor_position` | Get current cursor position |
|
|
86
|
+
|
|
87
|
+
### Situational
|
|
88
|
+
|
|
89
|
+
| Tool | Description |
|
|
90
|
+
|------|-------------|
|
|
91
|
+
| `computer_use_list_apps` | List running applications |
|
|
92
|
+
| `computer_use_list_windows` | List open windows |
|
|
93
|
+
| `computer_use_get_window_state` | Get window state/position |
|
|
94
|
+
| `computer_use_launch_app` | Launch an application |
|
|
95
|
+
| `computer_use_kill_app` | Kill an application |
|
|
96
|
+
|
|
97
|
+
## Excluded Tools (15)
|
|
98
|
+
|
|
99
|
+
Agent cursor styling, recording/replay, config management, and redundant operations (covered by other tools) are filtered out.
|
|
100
|
+
|
|
101
|
+
## Supported Platforms
|
|
102
|
+
|
|
103
|
+
| Platform | Binary |
|
|
104
|
+
|----------|--------|
|
|
105
|
+
| macOS ARM64 | `bin/darwin-arm64/cua-driver` |
|
|
106
|
+
| macOS x64 | `bin/darwin-x64/cua-driver` |
|
|
107
|
+
| Linux x64 | `bin/linux-x64/cua-driver` |
|
|
108
|
+
| Windows x64 | `bin/win32-x64/cua-driver.exe` |
|
|
109
|
+
| Windows ARM64 | `bin/win32-arm64/cua-driver.exe` |
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
Apache-2.0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/config.d.ts
CHANGED
|
@@ -1,31 +1,18 @@
|
|
|
1
|
+
import { type PiSettingsOptions } from '@amaster.ai/pi-shared/settings';
|
|
1
2
|
export interface VisionModelConfig {
|
|
2
3
|
provider: string;
|
|
3
4
|
model: string;
|
|
4
|
-
apiKey?: string;
|
|
5
|
-
baseUrl?: string;
|
|
6
5
|
}
|
|
7
6
|
export interface ComputerUseConfig {
|
|
8
|
-
/** '
|
|
9
|
-
mode?: '
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
package?: string;
|
|
14
|
-
/** Extra CLI args for cua-computer-server */
|
|
7
|
+
/** 'bundled' uses the packaged binary, 'path' uses a custom binary path */
|
|
8
|
+
mode?: 'bundled' | 'path';
|
|
9
|
+
/** Custom cua-driver binary path (used when mode is 'path') */
|
|
10
|
+
binaryPath?: string;
|
|
11
|
+
/** Extra CLI args passed to cua-driver mcp */
|
|
15
12
|
extraArgs?: string[];
|
|
16
|
-
/** Server host (default: '127.0.0.1') */
|
|
17
|
-
host?: string;
|
|
18
|
-
/** Server port (default: 8000) */
|
|
19
|
-
port?: number;
|
|
20
|
-
/** API key — enables wss + auth for cloud/remote */
|
|
21
|
-
apiKey?: string;
|
|
22
|
-
/** VM name for cloud routing */
|
|
23
|
-
vmName?: string;
|
|
24
|
-
/** Auto-screenshot after each action (default: true) */
|
|
25
|
-
autoScreenshot?: boolean;
|
|
26
13
|
/** Vision model for screenshot analysis */
|
|
27
14
|
visionModel?: VisionModelConfig;
|
|
28
15
|
}
|
|
29
16
|
export declare function resolveConfig(config?: ComputerUseConfig): ComputerUseConfig;
|
|
30
|
-
export declare function loadConfigFromFile(): ComputerUseConfig;
|
|
17
|
+
export declare function loadConfigFromFile(options?: PiSettingsOptions): ComputerUseConfig;
|
|
31
18
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGxF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAMD,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAE3E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAKjF"}
|
package/dist/config.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { loadPiSettings } from '@amaster.ai/pi-shared/settings';
|
|
2
|
+
import { getAgentDir } from '@earendil-works/pi-coding-agent';
|
|
2
3
|
const DEFAULTS = {
|
|
3
|
-
mode: '
|
|
4
|
-
command: 'uvx',
|
|
5
|
-
package: 'cua-computer-server',
|
|
6
|
-
host: '127.0.0.1',
|
|
7
|
-
port: 8000,
|
|
8
|
-
autoScreenshot: true,
|
|
4
|
+
mode: 'bundled',
|
|
9
5
|
};
|
|
10
6
|
export function resolveConfig(config) {
|
|
11
7
|
return { ...DEFAULTS, ...config };
|
|
12
8
|
}
|
|
13
|
-
export function loadConfigFromFile() {
|
|
14
|
-
return loadPiSettings('pi-computer-use'
|
|
9
|
+
export function loadConfigFromFile(options) {
|
|
10
|
+
return loadPiSettings('pi-computer-use', {
|
|
11
|
+
agentDir: getAgentDir(),
|
|
12
|
+
...options,
|
|
13
|
+
});
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA0B,MAAM,gCAAgC,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAkB9D,MAAM,QAAQ,GAA+B;IAC3C,IAAI,EAAE,SAAS;CAChB,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,MAA0B;IACtD,OAAO,EAAE,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAA2B;IAC5D,OAAO,cAAc,CAAoB,iBAAiB,EAAE;QAC1D,QAAQ,EAAE,WAAW,EAAE;QACvB,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AAEtF,OAAO,EAAE,KAAK,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIxF,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC;AAsB7C,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA+InE"}
|
package/dist/index.js
CHANGED
|
@@ -1,101 +1,129 @@
|
|
|
1
1
|
import { Type } from 'typebox';
|
|
2
|
-
import { dispatchAction } from './actions.js';
|
|
3
|
-
import { ComputerClient } from './computer-client.js';
|
|
4
2
|
import { loadConfigFromFile, resolveConfig } from './config.js';
|
|
5
|
-
import {
|
|
3
|
+
import { CuaDriverClient } from './mcp-client.js';
|
|
6
4
|
import { createPiVisionCaller } from './vision.js';
|
|
7
5
|
export { loadConfigFromFile, resolveConfig };
|
|
6
|
+
const TOOL_PREFIX = 'computer_use_';
|
|
7
|
+
const EXCLUDED_TOOLS = new Set([
|
|
8
|
+
'set_agent_cursor_enabled',
|
|
9
|
+
'set_agent_cursor_motion',
|
|
10
|
+
'set_agent_cursor_style',
|
|
11
|
+
'get_agent_cursor_state',
|
|
12
|
+
'set_recording',
|
|
13
|
+
'get_recording_state',
|
|
14
|
+
'replay_trajectory',
|
|
15
|
+
'check_permissions',
|
|
16
|
+
'get_config',
|
|
17
|
+
'set_config',
|
|
18
|
+
'move_cursor',
|
|
19
|
+
'zoom',
|
|
20
|
+
'type_text_chars',
|
|
21
|
+
'page',
|
|
22
|
+
'browser_eval',
|
|
23
|
+
]);
|
|
8
24
|
export default function computerUseExtension(pi) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
let config;
|
|
26
|
+
let client;
|
|
27
|
+
let connected = false;
|
|
28
|
+
async function ensureConnected() {
|
|
29
|
+
if (!client)
|
|
30
|
+
throw new Error('pi-computer-use: session not started');
|
|
31
|
+
if (!connected) {
|
|
32
|
+
await client.connect();
|
|
33
|
+
connected = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function registerUpstreamTools() {
|
|
37
|
+
await ensureConnected();
|
|
38
|
+
const upstreamTools = await client.listAllTools();
|
|
39
|
+
for (const tool of upstreamTools) {
|
|
40
|
+
if (EXCLUDED_TOOLS.has(tool.name))
|
|
41
|
+
continue;
|
|
42
|
+
const prefixedName = `${TOOL_PREFIX}${tool.name}`;
|
|
43
|
+
const originalName = tool.name;
|
|
44
|
+
pi.registerTool({
|
|
45
|
+
name: prefixedName,
|
|
46
|
+
label: prefixedName,
|
|
47
|
+
description: tool.description ?? '',
|
|
48
|
+
parameters: Type.Unsafe(tool.inputSchema),
|
|
49
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
50
|
+
await ensureConnected();
|
|
51
|
+
const result = await client.callTool(originalName, params);
|
|
52
|
+
if (originalName === 'screenshot' && config?.visionModel) {
|
|
53
|
+
const imageContent = result.content?.find((c) => c.type === 'image' && c.data);
|
|
54
|
+
if (imageContent?.data) {
|
|
55
|
+
const callVision = createPiVisionCaller(config.visionModel, ctx);
|
|
56
|
+
const analysis = await callVision('Describe the full screen: identify all visible windows, UI elements, buttons, text fields, and their positions.', imageContent.data, imageContent.mimeType ?? 'image/png');
|
|
57
|
+
return {
|
|
58
|
+
content: [{ type: 'text', text: analysis }],
|
|
59
|
+
details: undefined,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const content = [];
|
|
64
|
+
if (result.content) {
|
|
65
|
+
for (const item of result.content) {
|
|
66
|
+
if (item.type === 'text' && item.text) {
|
|
67
|
+
content.push({ type: 'text', text: item.text });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (content.length === 0) {
|
|
72
|
+
content.push({ type: 'text', text: 'Action executed.' });
|
|
73
|
+
}
|
|
74
|
+
return result.isError
|
|
75
|
+
? { content, details: undefined, isError: true }
|
|
76
|
+
: { content, details: undefined };
|
|
77
|
+
},
|
|
78
|
+
});
|
|
18
79
|
}
|
|
19
|
-
await client.connect();
|
|
20
|
-
started = true;
|
|
21
80
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
y: Type.Optional(Type.Number({ description: 'Y coordinate (click, double_click, move)' })),
|
|
34
|
-
button: Type.Optional(Type.String({ description: 'Mouse button: left | right (default: left)' })),
|
|
35
|
-
text: Type.Optional(Type.String({ description: 'Text to type (type action)' })),
|
|
36
|
-
keys: Type.Optional(Type.Array(Type.String(), { description: 'Keys to press (keypress action)' })),
|
|
37
|
-
scroll_x: Type.Optional(Type.Number({ description: 'Horizontal scroll amount' })),
|
|
38
|
-
scroll_y: Type.Optional(Type.Number({ description: 'Vertical scroll amount' })),
|
|
39
|
-
path: Type.Optional(Type.Array(Type.Tuple([Type.Number(), Type.Number()]), {
|
|
40
|
-
description: 'Drag path as [[x,y], ...] coordinates',
|
|
81
|
+
async function registerVisionTool() {
|
|
82
|
+
if (!config?.visionModel)
|
|
83
|
+
return;
|
|
84
|
+
const visionConfig = config.visionModel;
|
|
85
|
+
pi.registerTool({
|
|
86
|
+
name: `${TOOL_PREFIX}analyze_screenshot`,
|
|
87
|
+
label: `${TOOL_PREFIX}analyze_screenshot`,
|
|
88
|
+
description: 'Take a screenshot and analyze it visually using a vision model. Use when you need to identify elements by visual attributes (color, layout, position) or need precise pixel coordinates.',
|
|
89
|
+
parameters: Type.Object({
|
|
90
|
+
instruction: Type.Optional(Type.String({
|
|
91
|
+
description: 'What to identify or analyze visually (e.g., "Find the coordinates of the blue submit button").',
|
|
41
92
|
})),
|
|
42
|
-
command: Type.Optional(Type.String({ description: 'Shell command (run_command action)' })),
|
|
43
93
|
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (config.visionModel) {
|
|
50
|
-
const callVision = createPiVisionCaller(config.visionModel, ctx);
|
|
51
|
-
const analysis = await callVision('Describe the full screen: identify all visible windows, UI elements, buttons, text fields, and their positions.', screenshotBase64, 'image/png');
|
|
52
|
-
return { content: [{ type: 'text', text: analysis }], details: undefined };
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
content: [
|
|
56
|
-
{
|
|
57
|
-
type: 'text',
|
|
58
|
-
text: 'Screenshot captured (no vision model configured to analyze it).',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
details: undefined,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
const actionResult = await dispatchAction(client, params.action);
|
|
65
|
-
if (config.autoScreenshot !== false) {
|
|
66
|
-
const screenshotBase64 = await client.screenshot();
|
|
67
|
-
if (config.visionModel) {
|
|
68
|
-
const callVision = createPiVisionCaller(config.visionModel, ctx);
|
|
69
|
-
const analysis = await callVision('Describe the current screen state after the action. Focus on what changed and what is now visible.', screenshotBase64, 'image/png');
|
|
94
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
95
|
+
await ensureConnected();
|
|
96
|
+
const screenshotResult = await client.callTool('screenshot', {});
|
|
97
|
+
const imageContent = screenshotResult.content?.find((c) => c.type === 'image' && c.data);
|
|
98
|
+
if (!imageContent?.data) {
|
|
70
99
|
return {
|
|
71
|
-
content: [
|
|
72
|
-
{
|
|
73
|
-
type: 'text',
|
|
74
|
-
text: `${actionResult}\n\nScreen state:\n${analysis}`,
|
|
75
|
-
},
|
|
76
|
-
],
|
|
100
|
+
content: [{ type: 'text', text: 'Failed to capture screenshot.' }],
|
|
77
101
|
details: undefined,
|
|
102
|
+
isError: true,
|
|
78
103
|
};
|
|
79
104
|
}
|
|
105
|
+
const callVision = createPiVisionCaller(visionConfig, ctx);
|
|
106
|
+
const instruction = params.instruction ??
|
|
107
|
+
'Describe the full screen: identify all visible windows, UI elements, buttons, text fields, and their positions.';
|
|
108
|
+
const analysis = await callVision(instruction, imageContent.data, imageContent.mimeType ?? 'image/png');
|
|
80
109
|
return {
|
|
81
|
-
content: [{ type: 'text', text:
|
|
110
|
+
content: [{ type: 'text', text: analysis }],
|
|
82
111
|
details: undefined,
|
|
83
112
|
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
pi.on('session_start', async (_event, ctx) => {
|
|
117
|
+
config = resolveConfig(loadConfigFromFile({ cwd: ctx.cwd }));
|
|
118
|
+
client = new CuaDriverClient(config);
|
|
119
|
+
connected = false;
|
|
120
|
+
await registerUpstreamTools();
|
|
121
|
+
await registerVisionTool();
|
|
93
122
|
});
|
|
94
123
|
pi.on('session_shutdown', async () => {
|
|
95
|
-
if (
|
|
124
|
+
if (connected && client) {
|
|
96
125
|
await client.close();
|
|
97
|
-
|
|
98
|
-
started = false;
|
|
126
|
+
connected = false;
|
|
99
127
|
}
|
|
100
128
|
});
|
|
101
129
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAA0B,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC;AAE7C,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,0BAA0B;IAC1B,yBAAyB;IACzB,wBAAwB;IACxB,wBAAwB;IACxB,eAAe;IACf,qBAAqB;IACrB,mBAAmB;IACnB,mBAAmB;IACnB,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,MAAM;IACN,iBAAiB;IACjB,MAAM;IACN,cAAc;CACf,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAgB;IAC3D,IAAI,MAAqC,CAAC;IAC1C,IAAI,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AY,CAAC,QAAQ,IAAI,WAAW,CACrC,CAAC;gBAEF,OAAO;oBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;oBACpD,OAAO,EAAE,SAAS;iBACnB,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED,EAAE,CAAC,EAAE,CAAC,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE;QAC3C,MAAM,GAAG,aAAa,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC7D,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;QACrC,SAAS,GAAG,KAAK,CAAC;QAClB,MAAM,qBAAqB,EAAE,CAAC;QAC9B,MAAM,kBAAkB,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QACnC,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;YACxB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACrB,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import type { ComputerUseConfig } from './config.js';
|
|
3
|
+
export declare class CuaDriverClient {
|
|
4
|
+
private client;
|
|
5
|
+
private transport;
|
|
6
|
+
private config;
|
|
7
|
+
constructor(config: ComputerUseConfig);
|
|
8
|
+
connect(): Promise<void>;
|
|
9
|
+
listAllTools(): Promise<Tool[]>;
|
|
10
|
+
callTool(name: string, args: Record<string, unknown>): Promise<{
|
|
11
|
+
content?: Array<{
|
|
12
|
+
type: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
data?: string;
|
|
15
|
+
mimeType?: string;
|
|
16
|
+
}>;
|
|
17
|
+
isError?: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
close(): Promise<void>;
|
|
20
|
+
private resolveBinaryPath;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=mcp-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-client.d.ts","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAKrD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,MAAM,CAAoB;gBAEtB,MAAM,EAAE,iBAAiB;IAI/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBxB,YAAY,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAgB/B,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC;QACT,OAAO,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACnF,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC;IAWI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAQd,iBAAiB;CAmBhC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
5
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
6
|
+
const MCP_TIMEOUT_MS = 60_000;
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
export class CuaDriverClient {
|
|
9
|
+
client = null;
|
|
10
|
+
transport = null;
|
|
11
|
+
config;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
async connect() {
|
|
16
|
+
const binaryPath = await this.resolveBinaryPath();
|
|
17
|
+
const args = ['mcp', ...(this.config.extraArgs ?? [])];
|
|
18
|
+
this.transport = new StdioClientTransport({
|
|
19
|
+
command: binaryPath,
|
|
20
|
+
args,
|
|
21
|
+
stderr: 'pipe',
|
|
22
|
+
});
|
|
23
|
+
this.transport.onerror = (error) => {
|
|
24
|
+
console.error(`[pi-computer-use] cua-driver transport error: ${error.message}`);
|
|
25
|
+
};
|
|
26
|
+
this.client = new Client({ name: 'pi-computer-use', version: '0.1.0' }, { capabilities: {} });
|
|
27
|
+
await this.client.connect(this.transport);
|
|
28
|
+
}
|
|
29
|
+
async listAllTools() {
|
|
30
|
+
if (!this.client)
|
|
31
|
+
throw new Error('CuaDriverClient not connected');
|
|
32
|
+
const allTools = [];
|
|
33
|
+
let cursor;
|
|
34
|
+
do {
|
|
35
|
+
const result = await this.client.listTools(cursor ? { cursor } : undefined, {
|
|
36
|
+
timeout: MCP_TIMEOUT_MS,
|
|
37
|
+
});
|
|
38
|
+
allTools.push(...result.tools);
|
|
39
|
+
cursor = result.nextCursor;
|
|
40
|
+
} while (cursor);
|
|
41
|
+
return allTools;
|
|
42
|
+
}
|
|
43
|
+
async callTool(name, args) {
|
|
44
|
+
if (!this.client)
|
|
45
|
+
throw new Error('CuaDriverClient not connected');
|
|
46
|
+
return (await this.client.callTool({ name, arguments: args }, undefined, {
|
|
47
|
+
timeout: MCP_TIMEOUT_MS,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
async close() {
|
|
51
|
+
if (this.client) {
|
|
52
|
+
await this.client.close();
|
|
53
|
+
this.client = null;
|
|
54
|
+
}
|
|
55
|
+
this.transport = null;
|
|
56
|
+
}
|
|
57
|
+
async resolveBinaryPath() {
|
|
58
|
+
if (this.config.mode === 'path' && this.config.binaryPath) {
|
|
59
|
+
return this.config.binaryPath;
|
|
60
|
+
}
|
|
61
|
+
const platform = process.platform === 'win32' ? 'win32-x64' : `${process.platform}-${process.arch}`;
|
|
62
|
+
const ext = process.platform === 'win32' ? '.exe' : '';
|
|
63
|
+
const binPath = path.resolve(__dirname, '..', 'bin', platform, `cua-driver${ext}`);
|
|
64
|
+
if (!existsSync(binPath)) {
|
|
65
|
+
throw new Error(`[pi-computer-use] cua-driver binary not found at ${binPath}. ` +
|
|
66
|
+
`Platform "${platform}" may not be supported, or set mode: "path" with binaryPath in config.`);
|
|
67
|
+
}
|
|
68
|
+
return binPath;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=mcp-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-client.js","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAIjF,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,OAAO,eAAe;IAClB,MAAM,GAAkB,IAAI,CAAC;IAC7B,SAAS,GAAgC,IAAI,CAAC;IAC9C,MAAM,CAAoB;IAElC,YAAY,M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AAE,CAAC,CAAC;QAEnF,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,oDAAoD,OAAO,IAAI;gBAC7D,aAAa,QAAQ,wEAAwE,CAChG,CAAC;QACJ,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amaster.ai/pi-computer-use",
|
|
3
|
-
"version": "0.1.2-beta.
|
|
4
|
-
"description": "Pi extension for
|
|
3
|
+
"version": "0.1.2-beta.3",
|
|
4
|
+
"description": "Pi extension for desktop automation via cua-driver-rs with computer_use_ prefixed tools",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi",
|
|
7
|
+
"extension",
|
|
8
|
+
"computer-use",
|
|
9
|
+
"desktop",
|
|
10
|
+
"automation",
|
|
11
|
+
"cua-driver",
|
|
12
|
+
"mcp"
|
|
13
|
+
],
|
|
5
14
|
"license": "Apache-2.0",
|
|
6
15
|
"type": "module",
|
|
7
16
|
"sideEffects": false,
|
|
@@ -18,6 +27,7 @@
|
|
|
18
27
|
},
|
|
19
28
|
"files": [
|
|
20
29
|
"dist",
|
|
30
|
+
"bin",
|
|
21
31
|
"README.md"
|
|
22
32
|
],
|
|
23
33
|
"pi": {
|
|
@@ -34,8 +44,8 @@
|
|
|
34
44
|
"directory": "packages/pi-computer-use"
|
|
35
45
|
},
|
|
36
46
|
"dependencies": {
|
|
37
|
-
"
|
|
38
|
-
"@amaster.ai/pi-shared": "0.1.2-beta.
|
|
47
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
48
|
+
"@amaster.ai/pi-shared": "0.1.2-beta.3"
|
|
39
49
|
},
|
|
40
50
|
"peerDependencies": {
|
|
41
51
|
"@earendil-works/pi-ai": ">=0.74.0",
|
|
@@ -45,7 +55,6 @@
|
|
|
45
55
|
"devDependencies": {
|
|
46
56
|
"@earendil-works/pi-ai": "0.74.0",
|
|
47
57
|
"@earendil-works/pi-coding-agent": "0.74.0",
|
|
48
|
-
"@types/ws": "^8.5.0",
|
|
49
58
|
"tsup": "^8.4.0",
|
|
50
59
|
"typebox": "*",
|
|
51
60
|
"vitest": "^4.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"computer-client.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/computer-client.test.ts"],"names":[],"mappings":""}
|