@agent-sh/computer-use-linux 0.7.38 → 0.7.40
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 +3 -3
- package/npm/bin/computer-use-linux.js +12 -3
- package/npm/install.js +79 -20
- package/package.json +1 -1
- package/pi/extension/generated-tools.ts +3 -3
package/README.md
CHANGED
|
@@ -185,7 +185,7 @@ Validated manually on Ubuntu 25.10 (GNOME Shell 50.1, Wayland). niri window list
|
|
|
185
185
|
| KDE Plasma / KWin | temporary KWin DBus scripting | Lists and focuses windows through Plasma 5 or 6 `org.kde.KWin` scripting APIs when the session bus exposes them. IDs are derived from the KWin window UUID, stay the same for a window across calls, and fit JavaScript integers. |
|
|
186
186
|
| Hyprland | `hyprctl clients -j` and `hyprctl dispatch focuswindow` | Requires `hyprctl` in the desktop session. With `COMPUTER_USE_LINUX_HYPRLAND_BACKGROUND=1`, targeted keyboard input uses `send_key_state` and targeted capture uses `grim -T`, so neither focuses the window. |
|
|
187
187
|
| niri | `niri msg` with a direct JSON IPC fallback | Lists toplevels and focuses exact window IDs. Export the session's `NIRI_SOCKET`; otherwise discovery requires an unambiguous socket matching `WAYLAND_DISPLAY`. The fallback works without the `niri` binary. Missing positions remain `null`; bounds are omitted if output scaling is unknown or mixed. |
|
|
188
|
-
| i3, Sway | `i3-msg`, or `swaymsg` when i3 is not installed; on i3, optional `xprop` for PID hydration | Lists and focuses windows over the active i3 or Sway IPC socket. On Sway this covers native Wayland and Xwayland windows, with pids from the tree, and bounds scaled to capture pixels when every output has the same scale (left out with mixed scales). The socket is the first
|
|
188
|
+
| i3, Sway | `i3-msg`, or `swaymsg` when i3 is not installed; on i3, optional `xprop` for PID hydration | Lists and focuses windows over the active i3 or Sway IPC socket. On Sway this covers native Wayland and Xwayland windows, with pids from the tree, and bounds scaled to capture pixels when every output has the same scale (left out with mixed scales). The socket is the first of `I3SOCK` and `SWAYSOCK` that names a socket file, then the newest i3 socket, then the newest Sway socket in `XDG_RUNTIME_DIR`. X11 windows keep their X11 id; a native Wayland window on Sway gets 2^32 plus its container id, so the two never collide. |
|
|
189
189
|
| labwc with Selkies IPC | `$XDG_RUNTIME_DIR/labwc.sock` | Requires the Selkies IPC patch; stock labwc has no such socket. Lists windows and focuses unique app-id/title matches through `wlr-foreign-toplevel-management`. IDs include pid, app id and title, fit JavaScript integers, and change when the title changes. Ambiguous windows are rejected. Bounds are omitted because the IPC does not expose output scaling. |
|
|
190
190
|
| COSMIC Wayland | `computer-use-linux-cosmic` helper | Installed automatically by `./install.sh`, `cargo install`, and npm. For custom/manual layouts, put the helper next to the main binary, on `PATH`, or point `COMPUTER_USE_LINUX_COSMIC_HELPER` at it. The on-screen indicator was validated here (three outputs, mixed fractional scaling). |
|
|
191
191
|
| Other wlroots compositors (stock labwc, phoc, river-classic) | `zwlr_foreign_toplevel_manager_v1` on `WAYLAND_DISPLAY` | Lists toplevels with title, app id, and activated/minimized state, and focuses unique app-id/title matches. The protocol reports no pids or bounds. IDs derive from the app id and title, fit JavaScript integers, and change when the title changes; windows sharing both are rejected for exact focus. On Sway it answers only when the i3 backend does not: when neither `i3-msg` nor `swaymsg` is installed, the IPC socket cannot be reached, or it lists no windows. Compositors that do not advertise the protocol, such as Cage, are not supported. |
|
|
@@ -500,13 +500,13 @@ bundle): `CUL_GNOME_EXTENSION_UUID`, `CUL_DBUS_SERVICE`, and
|
|
|
500
500
|
UUID and DBus endpoint in both the Rust probes and the generated extension
|
|
501
501
|
files.
|
|
502
502
|
|
|
503
|
-
**npm wrapper** (set during `npm install`, or before running):
|
|
503
|
+
**npm wrapper** (set during `npm install`, or before running). The package's install script downloads the release binaries. When npm skipped it (npm 12 runs only install scripts it is told to allow), the wrapper runs the same download on first launch, with its output on stderr. A download that receives no data for 30 s fails:
|
|
504
504
|
|
|
505
505
|
| Variable | Effect |
|
|
506
506
|
| --- | --- |
|
|
507
507
|
| `COMPUTER_USE_LINUX_BIN` | Run this absolute binary path instead of the one bundled by the npm package. Relative paths are ignored. |
|
|
508
508
|
| `COMPUTER_USE_LINUX_DOWNLOAD_BASE` | Override the GitHub release base URL the installer downloads from (mirrors, air-gapped hosts). |
|
|
509
|
-
| `COMPUTER_USE_LINUX_SKIP_DOWNLOAD=1` | Skip the
|
|
509
|
+
| `COMPUTER_USE_LINUX_SKIP_DOWNLOAD=1` | Skip the binary download entirely, at install and at first launch. |
|
|
510
510
|
| `COMPUTER_USE_LINUX_LOCAL_BINARY` / `…_LOCAL_COSMIC_HELPER` / `…_LOCAL_INDICATOR` | Install from a local build instead of downloading (used by CI and local testing). |
|
|
511
511
|
|
|
512
512
|
## Architecture
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
const fs = require('node:fs');
|
|
5
5
|
const path = require('node:path');
|
|
6
|
-
const { spawn } = require('node:child_process');
|
|
6
|
+
const { spawn, spawnSync } = require('node:child_process');
|
|
7
7
|
|
|
8
8
|
const binaryName = `computer-use-linux-${process.platform}-${process.arch}`;
|
|
9
9
|
const bundledBinary = path.join(__dirname, binaryName);
|
|
@@ -11,11 +11,20 @@ const binary = process.env.COMPUTER_USE_LINUX_BIN || bundledBinary;
|
|
|
11
11
|
const bundledCosmicHelper = path.join(__dirname, 'computer-use-linux-cosmic');
|
|
12
12
|
const bundledIndicator = path.join(__dirname, 'computer-use-linux-indicator');
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// npm 12 skips install scripts it has not been told to allow, so a global
|
|
15
|
+
// install can arrive without the native binary. Run the installer on first
|
|
16
|
+
// launch. Its output goes to stderr: stdout is the MCP channel.
|
|
17
|
+
function installBinary() {
|
|
18
|
+
const installer = path.join(__dirname, '..', 'install.js');
|
|
19
|
+
const result = spawnSync(process.execPath, [installer], { stdio: ['ignore', 2, 2] });
|
|
20
|
+
return result.status === 0 && fs.existsSync(binary);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!fs.existsSync(binary) && (process.env.COMPUTER_USE_LINUX_BIN || !installBinary())) {
|
|
15
24
|
console.error(
|
|
16
25
|
[
|
|
17
26
|
`computer-use-linux binary not found: ${binary}`,
|
|
18
|
-
'
|
|
27
|
+
'Run `node npm/install.js` in the package directory, allow its install script, or set COMPUTER_USE_LINUX_BIN.',
|
|
19
28
|
].join('\n')
|
|
20
29
|
);
|
|
21
30
|
process.exit(127);
|
package/npm/install.js
CHANGED
|
@@ -18,36 +18,73 @@ const binDir = path.join(__dirname, 'bin');
|
|
|
18
18
|
const binaryPath = path.join(binDir, `computer-use-linux-${process.platform}-${process.arch}`);
|
|
19
19
|
const cosmicHelperPath = path.join(binDir, 'computer-use-linux-cosmic');
|
|
20
20
|
const indicatorPath = path.join(binDir, 'computer-use-linux-indicator');
|
|
21
|
+
// A request that receives no bytes for this long is stalled. The wrapper
|
|
22
|
+
// installs on first launch, so a stalled download would otherwise hold the
|
|
23
|
+
// MCP client's startup open and outlive it when the client gives up.
|
|
24
|
+
const IDLE_TIMEOUT_MS = 30_000;
|
|
25
|
+
|
|
26
|
+
// Messages can carry paths and URLs from the environment. JSON string
|
|
27
|
+
// escaping turns CR, LF and the other C0 control characters (U+0000-U+001F)
|
|
28
|
+
// into visible escapes, so a value with a newline cannot forge a log line.
|
|
29
|
+
function say(write, message) {
|
|
30
|
+
const safe = JSON.stringify(String(message)).slice(1, -1);
|
|
31
|
+
write(`[computer-use-linux] ${safe}`);
|
|
32
|
+
}
|
|
21
33
|
|
|
22
34
|
function fail(message) {
|
|
23
|
-
console.error
|
|
35
|
+
say(console.error, message);
|
|
24
36
|
process.exit(1);
|
|
25
37
|
}
|
|
26
38
|
|
|
39
|
+
// Write next to the destination, then rename over it, so a server starting
|
|
40
|
+
// at the same time (the wrapper installs on first launch) never runs a
|
|
41
|
+
// half-written binary.
|
|
42
|
+
function place(source, destination) {
|
|
43
|
+
const staging = `${destination}.tmp-${process.pid}-${crypto.randomBytes(4).toString('hex')}`;
|
|
44
|
+
try {
|
|
45
|
+
fs.copyFileSync(source, staging);
|
|
46
|
+
fs.chmodSync(staging, 0o755);
|
|
47
|
+
fs.renameSync(staging, destination);
|
|
48
|
+
} finally {
|
|
49
|
+
fs.rmSync(staging, { force: true });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
27
53
|
function copyLocalBinary(source) {
|
|
28
54
|
fs.mkdirSync(binDir, { recursive: true });
|
|
29
|
-
|
|
30
|
-
|
|
55
|
+
// Main binary last, as in main(): its presence tells the wrapper the
|
|
56
|
+
// helpers are in place.
|
|
31
57
|
if (process.env.COMPUTER_USE_LINUX_LOCAL_COSMIC_HELPER) {
|
|
32
|
-
|
|
33
|
-
fs.chmodSync(cosmicHelperPath, 0o755);
|
|
58
|
+
place(process.env.COMPUTER_USE_LINUX_LOCAL_COSMIC_HELPER, cosmicHelperPath);
|
|
34
59
|
}
|
|
35
60
|
if (process.env.COMPUTER_USE_LINUX_LOCAL_INDICATOR) {
|
|
36
|
-
|
|
37
|
-
fs.chmodSync(indicatorPath, 0o755);
|
|
61
|
+
place(process.env.COMPUTER_USE_LINUX_LOCAL_INDICATOR, indicatorPath);
|
|
38
62
|
}
|
|
39
|
-
|
|
63
|
+
place(source, binaryPath);
|
|
64
|
+
say(console.log, `installed local binary from ${source}`);
|
|
40
65
|
}
|
|
41
66
|
|
|
42
67
|
function download(url, destination, redirects = 5) {
|
|
43
68
|
return new Promise((resolve, reject) => {
|
|
69
|
+
// An explicit timer, re-armed on every chunk: Node's socket idle timeout
|
|
70
|
+
// did not fire at the requested time during a stalled TLS handshake.
|
|
71
|
+
let idle = null;
|
|
72
|
+
const disarm = () => clearTimeout(idle);
|
|
73
|
+
const arm = () => {
|
|
74
|
+
disarm();
|
|
75
|
+
idle = setTimeout(() => {
|
|
76
|
+
request.destroy(new Error(`no data for ${IDLE_TIMEOUT_MS / 1000} s: ${url}`));
|
|
77
|
+
}, IDLE_TIMEOUT_MS);
|
|
78
|
+
};
|
|
44
79
|
const request = https.get(url, (response) => {
|
|
80
|
+
arm();
|
|
45
81
|
if (
|
|
46
82
|
response.statusCode >= 300 &&
|
|
47
83
|
response.statusCode < 400 &&
|
|
48
84
|
response.headers.location &&
|
|
49
85
|
redirects > 0
|
|
50
86
|
) {
|
|
87
|
+
disarm();
|
|
51
88
|
response.resume();
|
|
52
89
|
const nextUrl = new URL(response.headers.location, url).toString();
|
|
53
90
|
download(nextUrl, destination, redirects - 1).then(resolve, reject);
|
|
@@ -55,6 +92,7 @@ function download(url, destination, redirects = 5) {
|
|
|
55
92
|
}
|
|
56
93
|
|
|
57
94
|
if (response.statusCode !== 200) {
|
|
95
|
+
disarm();
|
|
58
96
|
response.resume();
|
|
59
97
|
const error = new Error(`download failed with HTTP ${response.statusCode}: ${url}`);
|
|
60
98
|
error.statusCode = response.statusCode;
|
|
@@ -63,11 +101,22 @@ function download(url, destination, redirects = 5) {
|
|
|
63
101
|
}
|
|
64
102
|
|
|
65
103
|
const file = fs.createWriteStream(destination, { mode: 0o600 });
|
|
104
|
+
response.on('data', arm);
|
|
66
105
|
response.pipe(file);
|
|
67
|
-
file.on('finish', () =>
|
|
68
|
-
|
|
106
|
+
file.on('finish', () => {
|
|
107
|
+
disarm();
|
|
108
|
+
file.close(resolve);
|
|
109
|
+
});
|
|
110
|
+
file.on('error', (error) => {
|
|
111
|
+
disarm();
|
|
112
|
+
reject(error);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
arm();
|
|
116
|
+
request.on('error', (error) => {
|
|
117
|
+
disarm();
|
|
118
|
+
reject(error);
|
|
69
119
|
});
|
|
70
|
-
request.on('error', reject);
|
|
71
120
|
});
|
|
72
121
|
}
|
|
73
122
|
|
|
@@ -100,7 +149,7 @@ function sha256File(filePath) {
|
|
|
100
149
|
|
|
101
150
|
async function main() {
|
|
102
151
|
if (process.env.COMPUTER_USE_LINUX_SKIP_DOWNLOAD === '1') {
|
|
103
|
-
console.log
|
|
152
|
+
say(console.log, 'skipping binary download');
|
|
104
153
|
return;
|
|
105
154
|
}
|
|
106
155
|
|
|
@@ -124,6 +173,14 @@ async function main() {
|
|
|
124
173
|
const baseUrl =
|
|
125
174
|
process.env.COMPUTER_USE_LINUX_DOWNLOAD_BASE ||
|
|
126
175
|
`https://github.com/agent-sh/computer-use-linux/releases/download/v${pkg.version}`;
|
|
176
|
+
// Refuse before downloading ~15 MB that could not be installed (a global
|
|
177
|
+
// prefix owned by root).
|
|
178
|
+
try {
|
|
179
|
+
fs.accessSync(fs.existsSync(binDir) ? binDir : path.dirname(binDir), fs.constants.W_OK);
|
|
180
|
+
} catch (error) {
|
|
181
|
+
fail(`cannot write ${binDir}: ${error.message}`);
|
|
182
|
+
}
|
|
183
|
+
|
|
127
184
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'computer-use-linux-'));
|
|
128
185
|
const tmpBinary = path.join(tmpDir, asset);
|
|
129
186
|
const tmpSha = path.join(tmpDir, `${asset}.sha256`);
|
|
@@ -133,7 +190,7 @@ async function main() {
|
|
|
133
190
|
const tmpIndicatorSha = path.join(tmpDir, `${indicatorAsset}.sha256`);
|
|
134
191
|
|
|
135
192
|
try {
|
|
136
|
-
console.log
|
|
193
|
+
say(console.log, `downloading ${asset} from ${baseUrl}`);
|
|
137
194
|
await download(`${baseUrl}/${asset}`, tmpBinary);
|
|
138
195
|
await download(`${baseUrl}/${asset}.sha256`, tmpSha);
|
|
139
196
|
await download(`${baseUrl}/${cosmicAsset}`, tmpCosmic);
|
|
@@ -163,18 +220,20 @@ async function main() {
|
|
|
163
220
|
}
|
|
164
221
|
}
|
|
165
222
|
|
|
223
|
+
// The wrapper only checks for the main binary, so it goes last: once it
|
|
224
|
+
// exists, the helpers it points the server at exist too.
|
|
166
225
|
fs.mkdirSync(binDir, { recursive: true });
|
|
167
|
-
|
|
168
|
-
fs.chmodSync(binaryPath, 0o755);
|
|
169
|
-
fs.copyFileSync(tmpCosmic, cosmicHelperPath);
|
|
170
|
-
fs.chmodSync(cosmicHelperPath, 0o755);
|
|
226
|
+
place(tmpCosmic, cosmicHelperPath);
|
|
171
227
|
if (hasIndicator) {
|
|
172
|
-
|
|
173
|
-
fs.chmodSync(indicatorPath, 0o755);
|
|
228
|
+
place(tmpIndicator, indicatorPath);
|
|
174
229
|
} else {
|
|
175
230
|
fs.rmSync(indicatorPath, { force: true });
|
|
176
231
|
}
|
|
177
|
-
|
|
232
|
+
place(tmpBinary, binaryPath);
|
|
233
|
+
say(
|
|
234
|
+
console.log,
|
|
235
|
+
`installed ${asset} and ${cosmicAsset}${hasIndicator ? ` and ${indicatorAsset}` : ' (release has no indicator)'}`
|
|
236
|
+
);
|
|
178
237
|
} finally {
|
|
179
238
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
180
239
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-sh/computer-use-linux",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.40",
|
|
4
4
|
"description": "Native Linux desktop control for AI agents (MCP server, Pi tools, and CLI): semantic AT-SPI accessibility trees, screenshots, compositor window targeting, Wayland/X11 input, and an on-screen activity indicator.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -7,9 +7,9 @@ export interface GeneratedMcpToolDefinition {
|
|
|
7
7
|
annotations: Record<string, unknown>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const GENERATED_SERVER_VERSION = "0.7.
|
|
11
|
-
export const GENERATED_TOOL_CATALOG_HASH = "
|
|
12
|
-
export const GENERATED_SHELL_TOOL_CATALOG_HASH = "
|
|
10
|
+
export const GENERATED_SERVER_VERSION = "0.7.40";
|
|
11
|
+
export const GENERATED_TOOL_CATALOG_HASH = "c3da735e9c17d0bd15294e604abd28a6008e67d250f6db226da05e3f9504f68f";
|
|
12
|
+
export const GENERATED_SHELL_TOOL_CATALOG_HASH = "96bd879e7d29ef3f3193d49ef6f86b0d561b2ac9c7eeeece326c1637e1c6428f";
|
|
13
13
|
export const GENERATED_MCP_TOOLS =
|
|
14
14
|
[
|
|
15
15
|
{
|